From 059a20f6d4ea9404d99abd0a9f600f09b4ebcf43 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 7 Jan 2022 09:06:42 +0000 Subject: [PATCH] CodeGen from PR 16659 in Azure/azure-rest-api-specs Merge 09e2ab94a1f3cdd54e724190371b0fb962fe00b6 into 068f1ecdf3abb35a6a329a7b270c45df4d9c57a4 --- sdk/storage/azure-mgmt-storage/_meta.json | 10 +- .../azure/mgmt/storage/_configuration.py | 4 +- .../storage/_storage_management_client.py | 81 +- .../azure/mgmt/storage/aio/_configuration.py | 4 +- .../storage/aio/_storage_management_client.py | 82 +- .../azure/mgmt/storage/models.py | 2 +- .../mgmt/storage/v2015_06_15/__init__.py | 9 +- .../storage/v2015_06_15/_configuration.py | 19 +- .../mgmt/storage/v2015_06_15/_metadata.json | 21 +- .../azure/mgmt/storage/v2015_06_15/_patch.py | 31 + .../v2015_06_15/_storage_management.py | 85 +- .../azure/mgmt/storage/v2015_06_15/_vendor.py | 27 + .../mgmt/storage/v2015_06_15/_version.py | 2 +- .../mgmt/storage/v2015_06_15/aio/__init__.py | 5 + .../storage/v2015_06_15/aio/_configuration.py | 6 +- .../mgmt/storage/v2015_06_15/aio/_patch.py | 31 + .../v2015_06_15/aio/_storage_management.py | 76 +- .../_storage_accounts_operations.py | 386 +- .../aio/operations/_usage_operations.py | 53 +- .../storage/v2015_06_15/models/__init__.py | 45 +- .../storage/v2015_06_15/models/_models.py | 493 - .../storage/v2015_06_15/models/_models_py3.py | 333 +- .../models/_storage_management_enums.py | 29 +- .../_storage_accounts_operations.py | 820 +- .../operations/_usage_operations.py | 97 +- .../mgmt/storage/v2016_01_01/__init__.py | 9 +- .../storage/v2016_01_01/_configuration.py | 19 +- .../mgmt/storage/v2016_01_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2016_01_01/_patch.py | 31 + .../v2016_01_01/_storage_management_client.py | 85 +- .../azure/mgmt/storage/v2016_01_01/_vendor.py | 27 + .../mgmt/storage/v2016_01_01/_version.py | 2 +- .../mgmt/storage/v2016_01_01/aio/__init__.py | 5 + .../storage/v2016_01_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2016_01_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 76 +- .../_storage_accounts_operations.py | 386 +- .../aio/operations/_usage_operations.py | 53 +- .../storage/v2016_01_01/models/__init__.py | 60 +- .../storage/v2016_01_01/models/_models.py | 745 -- .../storage/v2016_01_01/models/_models_py3.py | 224 +- .../_storage_management_client_enums.py | 37 +- .../_storage_accounts_operations.py | 820 +- .../operations/_usage_operations.py | 97 +- .../mgmt/storage/v2016_12_01/__init__.py | 9 +- .../storage/v2016_12_01/_configuration.py | 19 +- .../mgmt/storage/v2016_12_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2016_12_01/_patch.py | 31 + .../v2016_12_01/_storage_management.py | 85 +- .../azure/mgmt/storage/v2016_12_01/_vendor.py | 27 + .../mgmt/storage/v2016_12_01/_version.py | 2 +- .../mgmt/storage/v2016_12_01/aio/__init__.py | 5 + .../storage/v2016_12_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2016_12_01/aio/_patch.py | 31 + .../v2016_12_01/aio/_storage_management.py | 76 +- .../_storage_accounts_operations.py | 464 +- .../aio/operations/_usage_operations.py | 53 +- .../storage/v2016_12_01/models/__init__.py | 72 +- .../storage/v2016_12_01/models/_models.py | 997 -- .../storage/v2016_12_01/models/_models_py3.py | 437 +- .../models/_storage_management_enums.py | 49 +- .../_storage_accounts_operations.py | 1008 +- .../operations/_usage_operations.py | 97 +- .../mgmt/storage/v2017_06_01/__init__.py | 9 +- .../storage/v2017_06_01/_configuration.py | 19 +- .../mgmt/storage/v2017_06_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2017_06_01/_patch.py | 31 + .../v2017_06_01/_storage_management.py | 95 +- .../azure/mgmt/storage/v2017_06_01/_vendor.py | 27 + .../mgmt/storage/v2017_06_01/_version.py | 2 +- .../mgmt/storage/v2017_06_01/aio/__init__.py | 5 + .../storage/v2017_06_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2017_06_01/aio/_patch.py | 31 + .../v2017_06_01/aio/_storage_management.py | 84 +- .../v2017_06_01/aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 464 +- .../aio/operations/_usage_operations.py | 53 +- .../storage/v2017_06_01/models/__init__.py | 114 +- .../storage/v2017_06_01/models/_models.py | 1488 --- .../storage/v2017_06_01/models/_models_py3.py | 735 +- .../models/_storage_management_enums.py | 57 +- .../v2017_06_01/operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1008 +- .../operations/_usage_operations.py | 97 +- .../mgmt/storage/v2017_10_01/__init__.py | 9 +- .../storage/v2017_10_01/_configuration.py | 19 +- .../mgmt/storage/v2017_10_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2017_10_01/_patch.py | 31 + .../v2017_10_01/_storage_management.py | 95 +- .../azure/mgmt/storage/v2017_10_01/_vendor.py | 27 + .../mgmt/storage/v2017_10_01/_version.py | 2 +- .../mgmt/storage/v2017_10_01/aio/__init__.py | 5 + .../storage/v2017_10_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2017_10_01/aio/_patch.py | 31 + .../v2017_10_01/aio/_storage_management.py | 84 +- .../v2017_10_01/aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 464 +- .../aio/operations/_usage_operations.py | 53 +- .../storage/v2017_10_01/models/__init__.py | 114 +- .../storage/v2017_10_01/models/_models.py | 1493 --- .../storage/v2017_10_01/models/_models_py3.py | 742 +- .../models/_storage_management_enums.py | 57 +- .../v2017_10_01/operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1008 +- .../operations/_usage_operations.py | 97 +- .../mgmt/storage/v2018_02_01/__init__.py | 9 +- .../storage/v2018_02_01/_configuration.py | 19 +- .../mgmt/storage/v2018_02_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2018_02_01/_patch.py | 31 + .../v2018_02_01/_storage_management_client.py | 96 +- .../azure/mgmt/storage/v2018_02_01/_vendor.py | 27 + .../mgmt/storage/v2018_02_01/_version.py | 2 +- .../mgmt/storage/v2018_02_01/aio/__init__.py | 5 + .../storage/v2018_02_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2018_02_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 90 +- .../operations/_blob_containers_operations.py | 523 +- .../v2018_02_01/aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 464 +- .../aio/operations/_usage_operations.py | 100 +- .../storage/v2018_02_01/models/__init__.py | 153 +- .../storage/v2018_02_01/models/_models.py | 2133 ----- .../storage/v2018_02_01/models/_models_py3.py | 892 +- .../_storage_management_client_enums.py | 71 +- .../operations/_blob_containers_operations.py | 1258 ++- .../v2018_02_01/operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1008 +- .../operations/_usage_operations.py | 181 +- .../storage/v2018_03_01_preview/__init__.py | 9 +- .../v2018_03_01_preview/_configuration.py | 19 +- .../v2018_03_01_preview/_metadata.json | 21 +- .../storage/v2018_03_01_preview/_patch.py | 31 + .../_storage_management_client.py | 102 +- .../storage/v2018_03_01_preview/_vendor.py | 27 + .../storage/v2018_03_01_preview/_version.py | 2 +- .../v2018_03_01_preview/aio/__init__.py | 5 + .../v2018_03_01_preview/aio/_configuration.py | 6 +- .../storage/v2018_03_01_preview/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 90 +- .../operations/_blob_containers_operations.py | 523 +- .../aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 580 +- .../aio/operations/_usages_operations.py | 100 +- .../v2018_03_01_preview/models/__init__.py | 165 +- .../v2018_03_01_preview/models/_models.py | 2253 ----- .../v2018_03_01_preview/models/_models_py3.py | 934 +- .../_storage_management_client_enums.py | 73 +- .../operations/_blob_containers_operations.py | 1258 ++- .../operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1276 ++- .../operations/_usages_operations.py | 187 +- .../mgmt/storage/v2018_07_01/__init__.py | 9 +- .../storage/v2018_07_01/_configuration.py | 19 +- .../mgmt/storage/v2018_07_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2018_07_01/_patch.py | 31 + .../v2018_07_01/_storage_management_client.py | 107 +- .../azure/mgmt/storage/v2018_07_01/_vendor.py | 27 + .../mgmt/storage/v2018_07_01/_version.py | 2 +- .../mgmt/storage/v2018_07_01/aio/__init__.py | 5 + .../storage/v2018_07_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2018_07_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 101 +- .../operations/_blob_containers_operations.py | 523 +- .../operations/_blob_services_operations.py | 82 +- .../_management_policies_operations.py | 121 +- .../v2018_07_01/aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 518 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2018_07_01/models/__init__.py | 180 +- .../storage/v2018_07_01/models/_models.py | 2468 ----- .../storage/v2018_07_01/models/_models_py3.py | 1043 ++- .../_storage_management_client_enums.py | 77 +- .../operations/_blob_containers_operations.py | 1258 ++- .../operations/_blob_services_operations.py | 198 +- .../_management_policies_operations.py | 283 +- .../v2018_07_01/operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1115 ++- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2018_11_01/__init__.py | 9 +- .../storage/v2018_11_01/_configuration.py | 19 +- .../mgmt/storage/v2018_11_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2018_11_01/_patch.py | 31 + .../v2018_11_01/_storage_management_client.py | 107 +- .../azure/mgmt/storage/v2018_11_01/_vendor.py | 27 + .../mgmt/storage/v2018_11_01/_version.py | 2 +- .../mgmt/storage/v2018_11_01/aio/__init__.py | 5 + .../storage/v2018_11_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2018_11_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 101 +- .../operations/_blob_containers_operations.py | 523 +- .../operations/_blob_services_operations.py | 82 +- .../_management_policies_operations.py | 121 +- .../v2018_11_01/aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 546 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2018_11_01/models/__init__.py | 198 +- .../storage/v2018_11_01/models/_models.py | 2646 ------ .../storage/v2018_11_01/models/_models_py3.py | 1144 ++- .../_storage_management_client_enums.py | 79 +- .../operations/_blob_containers_operations.py | 1258 ++- .../operations/_blob_services_operations.py | 198 +- .../_management_policies_operations.py | 283 +- .../v2018_11_01/operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1181 ++- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2019_04_01/__init__.py | 9 +- .../storage/v2019_04_01/_configuration.py | 19 +- .../mgmt/storage/v2019_04_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2019_04_01/_patch.py | 31 + .../v2019_04_01/_storage_management_client.py | 117 +- .../azure/mgmt/storage/v2019_04_01/_vendor.py | 27 + .../mgmt/storage/v2019_04_01/_version.py | 2 +- .../mgmt/storage/v2019_04_01/aio/__init__.py | 5 + .../storage/v2019_04_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2019_04_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 109 +- .../operations/_blob_containers_operations.py | 555 +- .../operations/_blob_services_operations.py | 133 +- .../operations/_file_services_operations.py | 113 +- .../aio/operations/_file_shares_operations.py | 218 +- .../_management_policies_operations.py | 121 +- .../v2019_04_01/aio/operations/_operations.py | 45 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 552 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2019_04_01/models/__init__.py | 228 +- .../storage/v2019_04_01/models/_models.py | 3112 ------- .../storage/v2019_04_01/models/_models_py3.py | 1390 ++- .../_storage_management_client_enums.py | 85 +- .../operations/_blob_containers_operations.py | 1302 ++- .../operations/_blob_services_operations.py | 289 +- .../operations/_file_services_operations.py | 273 +- .../operations/_file_shares_operations.py | 501 +- .../_management_policies_operations.py | 283 +- .../v2019_04_01/operations/_operations.py | 86 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1193 ++- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2019_06_01/__init__.py | 9 +- .../storage/v2019_06_01/_configuration.py | 19 +- .../mgmt/storage/v2019_06_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2019_06_01/_patch.py | 31 + .../v2019_06_01/_storage_management_client.py | 168 +- .../azure/mgmt/storage/v2019_06_01/_vendor.py | 27 + .../mgmt/storage/v2019_06_01/_version.py | 2 +- .../mgmt/storage/v2019_06_01/aio/__init__.py | 5 + .../storage/v2019_06_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2019_06_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 160 +- .../operations/_blob_containers_operations.py | 555 +- .../_blob_inventory_policies_operations.py | 185 +- .../operations/_blob_services_operations.py | 133 +- .../_encryption_scopes_operations.py | 183 +- .../operations/_file_services_operations.py | 113 +- .../aio/operations/_file_shares_operations.py | 267 +- .../_management_policies_operations.py | 121 +- ..._object_replication_policies_operations.py | 176 +- .../v2019_06_01/aio/operations/_operations.py | 45 +- ...private_endpoint_connections_operations.py | 174 +- .../_private_link_resources_operations.py | 39 +- .../aio/operations/_queue_operations.py | 214 +- .../operations/_queue_services_operations.py | 113 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 622 +- .../aio/operations/_table_operations.py | 190 +- .../operations/_table_services_operations.py | 113 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2019_06_01/models/__init__.py | 357 +- .../storage/v2019_06_01/models/_models.py | 4921 ---------- .../storage/v2019_06_01/models/_models_py3.py | 2207 +++-- .../_storage_management_client_enums.py | 117 +- .../operations/_blob_containers_operations.py | 1302 ++- .../_blob_inventory_policies_operations.py | 396 +- .../operations/_blob_services_operations.py | 289 +- .../_encryption_scopes_operations.py | 405 +- .../operations/_file_services_operations.py | 273 +- .../operations/_file_shares_operations.py | 615 +- .../_management_policies_operations.py | 283 +- ..._object_replication_policies_operations.py | 387 +- .../v2019_06_01/operations/_operations.py | 86 +- ...private_endpoint_connections_operations.py | 385 +- .../_private_link_resources_operations.py | 95 +- .../operations/_queue_operations.py | 492 +- .../operations/_queue_services_operations.py | 273 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1326 ++- .../operations/_table_operations.py | 434 +- .../operations/_table_services_operations.py | 273 +- .../operations/_usages_operations.py | 104 +- .../storage/v2020_08_01_preview/__init__.py | 9 +- .../v2020_08_01_preview/_configuration.py | 19 +- .../v2020_08_01_preview/_metadata.json | 21 +- .../storage/v2020_08_01_preview/_patch.py | 31 + .../_storage_management_client.py | 193 +- .../storage/v2020_08_01_preview/_vendor.py | 27 + .../storage/v2020_08_01_preview/_version.py | 2 +- .../v2020_08_01_preview/aio/__init__.py | 5 + .../v2020_08_01_preview/aio/_configuration.py | 6 +- .../storage/v2020_08_01_preview/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 182 +- .../operations/_blob_containers_operations.py | 555 +- .../_blob_inventory_policies_operations.py | 185 +- .../operations/_blob_services_operations.py | 133 +- .../_deleted_accounts_operations.py | 91 +- .../_encryption_scopes_operations.py | 183 +- .../operations/_file_services_operations.py | 113 +- .../aio/operations/_file_shares_operations.py | 281 +- .../_management_policies_operations.py | 121 +- ..._object_replication_policies_operations.py | 176 +- .../aio/operations/_operations.py | 45 +- ...private_endpoint_connections_operations.py | 174 +- .../_private_link_resources_operations.py | 39 +- .../aio/operations/_queue_operations.py | 214 +- .../operations/_queue_services_operations.py | 113 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 622 +- .../aio/operations/_table_operations.py | 190 +- .../operations/_table_services_operations.py | 113 +- .../aio/operations/_usages_operations.py | 56 +- .../v2020_08_01_preview/models/__init__.py | 381 +- .../v2020_08_01_preview/models/_models.py | 5194 ----------- .../v2020_08_01_preview/models/_models_py3.py | 2315 +++-- .../_storage_management_client_enums.py | 121 +- .../operations/_blob_containers_operations.py | 1305 ++- .../_blob_inventory_policies_operations.py | 396 +- .../operations/_blob_services_operations.py | 292 +- .../_deleted_accounts_operations.py | 182 +- .../_encryption_scopes_operations.py | 405 +- .../operations/_file_services_operations.py | 273 +- .../operations/_file_shares_operations.py | 648 +- .../_management_policies_operations.py | 283 +- ..._object_replication_policies_operations.py | 387 +- .../operations/_operations.py | 86 +- ...private_endpoint_connections_operations.py | 385 +- .../_private_link_resources_operations.py | 95 +- .../operations/_queue_operations.py | 495 +- .../operations/_queue_services_operations.py | 273 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1332 ++- .../operations/_table_operations.py | 437 +- .../operations/_table_services_operations.py | 273 +- .../operations/_usages_operations.py | 107 +- .../mgmt/storage/v2021_01_01/__init__.py | 9 +- .../storage/v2021_01_01/_configuration.py | 19 +- .../mgmt/storage/v2021_01_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_01_01/_patch.py | 31 + .../v2021_01_01/_storage_management_client.py | 172 +- .../azure/mgmt/storage/v2021_01_01/_vendor.py | 27 + .../mgmt/storage/v2021_01_01/_version.py | 2 +- .../mgmt/storage/v2021_01_01/aio/__init__.py | 5 + .../storage/v2021_01_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2021_01_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 167 +- .../operations/_blob_containers_operations.py | 555 +- .../_blob_inventory_policies_operations.py | 185 +- .../operations/_blob_services_operations.py | 133 +- .../_deleted_accounts_operations.py | 91 +- .../_encryption_scopes_operations.py | 183 +- .../operations/_file_services_operations.py | 113 +- .../aio/operations/_file_shares_operations.py | 279 +- .../_management_policies_operations.py | 121 +- ..._object_replication_policies_operations.py | 176 +- .../v2021_01_01/aio/operations/_operations.py | 45 +- ...private_endpoint_connections_operations.py | 174 +- .../_private_link_resources_operations.py | 39 +- .../aio/operations/_queue_operations.py | 214 +- .../operations/_queue_services_operations.py | 113 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 622 +- .../aio/operations/_table_operations.py | 190 +- .../operations/_table_services_operations.py | 113 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2021_01_01/models/__init__.py | 387 +- .../storage/v2021_01_01/models/_models.py | 5289 ----------- .../storage/v2021_01_01/models/_models_py3.py | 2376 +++-- .../_storage_management_client_enums.py | 125 +- .../operations/_blob_containers_operations.py | 1302 ++- .../_blob_inventory_policies_operations.py | 396 +- .../operations/_blob_services_operations.py | 289 +- .../_deleted_accounts_operations.py | 182 +- .../_encryption_scopes_operations.py | 405 +- .../operations/_file_services_operations.py | 273 +- .../operations/_file_shares_operations.py | 643 +- .../_management_policies_operations.py | 283 +- ..._object_replication_policies_operations.py | 387 +- .../v2021_01_01/operations/_operations.py | 86 +- ...private_endpoint_connections_operations.py | 385 +- .../_private_link_resources_operations.py | 95 +- .../operations/_queue_operations.py | 492 +- .../operations/_queue_services_operations.py | 273 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1326 ++- .../operations/_table_operations.py | 434 +- .../operations/_table_services_operations.py | 273 +- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2021_02_01/__init__.py | 9 +- .../storage/v2021_02_01/_configuration.py | 19 +- .../mgmt/storage/v2021_02_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_02_01/_patch.py | 31 + .../v2021_02_01/_storage_management_client.py | 172 +- .../azure/mgmt/storage/v2021_02_01/_vendor.py | 27 + .../mgmt/storage/v2021_02_01/_version.py | 2 +- .../mgmt/storage/v2021_02_01/aio/__init__.py | 5 + .../storage/v2021_02_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2021_02_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 167 +- .../operations/_blob_containers_operations.py | 555 +- .../_blob_inventory_policies_operations.py | 185 +- .../operations/_blob_services_operations.py | 133 +- .../_deleted_accounts_operations.py | 91 +- .../_encryption_scopes_operations.py | 183 +- .../operations/_file_services_operations.py | 113 +- .../aio/operations/_file_shares_operations.py | 279 +- .../_management_policies_operations.py | 121 +- ..._object_replication_policies_operations.py | 176 +- .../v2021_02_01/aio/operations/_operations.py | 45 +- ...private_endpoint_connections_operations.py | 174 +- .../_private_link_resources_operations.py | 39 +- .../aio/operations/_queue_operations.py | 214 +- .../operations/_queue_services_operations.py | 113 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 622 +- .../aio/operations/_table_operations.py | 190 +- .../operations/_table_services_operations.py | 113 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2021_02_01/models/__init__.py | 396 +- .../storage/v2021_02_01/models/_models.py | 5404 ----------- .../storage/v2021_02_01/models/_models_py3.py | 2437 +++-- .../_storage_management_client_enums.py | 127 +- .../operations/_blob_containers_operations.py | 1302 ++- .../_blob_inventory_policies_operations.py | 396 +- .../operations/_blob_services_operations.py | 289 +- .../_deleted_accounts_operations.py | 182 +- .../_encryption_scopes_operations.py | 405 +- .../operations/_file_services_operations.py | 273 +- .../operations/_file_shares_operations.py | 643 +- .../_management_policies_operations.py | 283 +- ..._object_replication_policies_operations.py | 387 +- .../v2021_02_01/operations/_operations.py | 86 +- ...private_endpoint_connections_operations.py | 385 +- .../_private_link_resources_operations.py | 95 +- .../operations/_queue_operations.py | 492 +- .../operations/_queue_services_operations.py | 273 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1326 ++- .../operations/_table_operations.py | 434 +- .../operations/_table_services_operations.py | 273 +- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2021_04_01/__init__.py | 9 +- .../storage/v2021_04_01/_configuration.py | 19 +- .../mgmt/storage/v2021_04_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_04_01/_patch.py | 31 + .../v2021_04_01/_storage_management_client.py | 172 +- .../azure/mgmt/storage/v2021_04_01/_vendor.py | 27 + .../mgmt/storage/v2021_04_01/_version.py | 2 +- .../mgmt/storage/v2021_04_01/aio/__init__.py | 5 + .../storage/v2021_04_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2021_04_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 167 +- .../operations/_blob_containers_operations.py | 610 +- .../_blob_inventory_policies_operations.py | 185 +- .../operations/_blob_services_operations.py | 133 +- .../_deleted_accounts_operations.py | 91 +- .../_encryption_scopes_operations.py | 183 +- .../operations/_file_services_operations.py | 119 +- .../aio/operations/_file_shares_operations.py | 342 +- .../_management_policies_operations.py | 121 +- ..._object_replication_policies_operations.py | 176 +- .../v2021_04_01/aio/operations/_operations.py | 45 +- ...private_endpoint_connections_operations.py | 174 +- .../_private_link_resources_operations.py | 39 +- .../aio/operations/_queue_operations.py | 224 +- .../operations/_queue_services_operations.py | 119 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 622 +- .../aio/operations/_table_operations.py | 200 +- .../operations/_table_services_operations.py | 119 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2021_04_01/models/__init__.py | 417 +- .../storage/v2021_04_01/models/_models.py | 5726 ------------ .../storage/v2021_04_01/models/_models_py3.py | 2676 ++++-- .../_storage_management_client_enums.py | 135 +- .../operations/_blob_containers_operations.py | 1416 ++- .../_blob_inventory_policies_operations.py | 396 +- .../operations/_blob_services_operations.py | 289 +- .../_deleted_accounts_operations.py | 182 +- .../_encryption_scopes_operations.py | 405 +- .../operations/_file_services_operations.py | 279 +- .../operations/_file_shares_operations.py | 775 +- .../_management_policies_operations.py | 283 +- ..._object_replication_policies_operations.py | 387 +- .../v2021_04_01/operations/_operations.py | 86 +- ...private_endpoint_connections_operations.py | 385 +- .../_private_link_resources_operations.py | 95 +- .../operations/_queue_operations.py | 502 +- .../operations/_queue_services_operations.py | 279 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1326 ++- .../operations/_table_operations.py | 444 +- .../operations/_table_services_operations.py | 279 +- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2021_06_01/__init__.py | 9 +- .../storage/v2021_06_01/_configuration.py | 19 +- .../mgmt/storage/v2021_06_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_06_01/_patch.py | 31 + .../v2021_06_01/_storage_management_client.py | 172 +- .../azure/mgmt/storage/v2021_06_01/_vendor.py | 27 + .../mgmt/storage/v2021_06_01/_version.py | 2 +- .../mgmt/storage/v2021_06_01/aio/__init__.py | 5 + .../storage/v2021_06_01/aio/_configuration.py | 6 +- .../mgmt/storage/v2021_06_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 167 +- .../operations/_blob_containers_operations.py | 610 +- .../_blob_inventory_policies_operations.py | 185 +- .../operations/_blob_services_operations.py | 133 +- .../_deleted_accounts_operations.py | 91 +- .../_encryption_scopes_operations.py | 183 +- .../operations/_file_services_operations.py | 119 +- .../aio/operations/_file_shares_operations.py | 342 +- .../_management_policies_operations.py | 121 +- ..._object_replication_policies_operations.py | 176 +- .../v2021_06_01/aio/operations/_operations.py | 45 +- ...private_endpoint_connections_operations.py | 174 +- .../_private_link_resources_operations.py | 39 +- .../aio/operations/_queue_operations.py | 224 +- .../operations/_queue_services_operations.py | 119 +- .../aio/operations/_skus_operations.py | 56 +- .../_storage_accounts_operations.py | 734 +- .../aio/operations/_table_operations.py | 200 +- .../operations/_table_services_operations.py | 119 +- .../aio/operations/_usages_operations.py | 56 +- .../storage/v2021_06_01/models/__init__.py | 426 +- .../storage/v2021_06_01/models/_models.py | 5943 ------------ .../storage/v2021_06_01/models/_models_py3.py | 2896 ++++-- .../_storage_management_client_enums.py | 139 +- .../operations/_blob_containers_operations.py | 1416 ++- .../_blob_inventory_policies_operations.py | 396 +- .../operations/_blob_services_operations.py | 289 +- .../_deleted_accounts_operations.py | 182 +- .../_encryption_scopes_operations.py | 405 +- .../operations/_file_services_operations.py | 279 +- .../operations/_file_shares_operations.py | 775 +- .../_management_policies_operations.py | 283 +- ..._object_replication_policies_operations.py | 387 +- .../v2021_06_01/operations/_operations.py | 86 +- ...private_endpoint_connections_operations.py | 385 +- .../_private_link_resources_operations.py | 95 +- .../operations/_queue_operations.py | 502 +- .../operations/_queue_services_operations.py | 279 +- .../operations/_skus_operations.py | 103 +- .../_storage_accounts_operations.py | 1551 ++-- .../operations/_table_operations.py | 444 +- .../operations/_table_services_operations.py | 279 +- .../operations/_usages_operations.py | 104 +- .../mgmt/storage/v2021_08_01/__init__.py | 18 + .../storage/v2021_08_01/_configuration.py | 68 + .../mgmt/storage/v2021_08_01/_metadata.json | 121 + .../azure/mgmt/storage/v2021_08_01/_patch.py | 31 + .../v2021_08_01/_storage_management_client.py | 156 + .../azure/mgmt/storage/v2021_08_01/_vendor.py | 27 + .../mgmt/storage/v2021_08_01/_version.py | 9 + .../mgmt/storage/v2021_08_01/aio/__init__.py | 15 + .../storage/v2021_08_01/aio/_configuration.py | 67 + .../mgmt/storage/v2021_08_01/aio/_patch.py | 31 + .../aio/_storage_management_client.py | 156 + .../v2021_08_01/aio/operations/__init__.py | 51 + .../operations/_blob_containers_operations.py | 1114 +++ .../_blob_inventory_policies_operations.py | 313 + .../operations/_blob_services_operations.py | 243 + .../_deleted_accounts_operations.py | 165 + .../_encryption_scopes_operations.py | 334 + .../operations/_file_services_operations.py | 221 + .../aio/operations/_file_shares_operations.py | 584 ++ .../aio/operations/_local_users_operations.py | 404 + .../_management_policies_operations.py | 229 + ..._object_replication_policies_operations.py | 317 + .../v2021_08_01/aio/operations/_operations.py | 109 + ...private_endpoint_connections_operations.py | 309 + .../_private_link_resources_operations.py | 99 + .../aio/operations/_queue_operations.py | 397 + .../operations/_queue_services_operations.py | 221 + .../aio/operations/_skus_operations.py | 112 + .../_storage_accounts_operations.py | 1277 +++ .../aio/operations/_table_operations.py | 365 + .../operations/_table_services_operations.py | 221 + .../aio/operations/_usages_operations.py | 117 + .../storage/v2021_08_01/models/__init__.py | 433 + .../storage/v2021_08_01/models/_models_py3.py | 8151 +++++++++++++++++ .../_storage_management_client_enums.py | 528 ++ .../v2021_08_01/operations/__init__.py | 51 + .../operations/_blob_containers_operations.py | 1719 ++++ .../_blob_inventory_policies_operations.py | 470 + .../operations/_blob_services_operations.py | 362 + .../_deleted_accounts_operations.py | 232 + .../_encryption_scopes_operations.py | 500 + .../operations/_file_services_operations.py | 342 + .../operations/_file_shares_operations.py | 908 ++ .../operations/_local_users_operations.py | 636 ++ .../_management_policies_operations.py | 346 + ..._object_replication_policies_operations.py | 474 + .../v2021_08_01/operations/_operations.py | 135 + ...private_endpoint_connections_operations.py | 466 + .../_private_link_resources_operations.py | 136 + .../operations/_queue_operations.py | 606 ++ .../operations/_queue_services_operations.py | 342 + .../operations/_skus_operations.py | 144 + .../_storage_accounts_operations.py | 1883 ++++ .../operations/_table_operations.py | 548 ++ .../operations/_table_services_operations.py | 342 + .../operations/_usages_operations.py | 150 + .../azure/mgmt/storage/v2021_08_01/py.typed | 1 + 623 files changed, 109919 insertions(+), 101998 deletions(-) create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_patch.py delete mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_patch.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/py.typed diff --git a/sdk/storage/azure-mgmt-storage/_meta.json b/sdk/storage/azure-mgmt-storage/_meta.json index c3a7720c0900..b1ae5647e3c5 100644 --- a/sdk/storage/azure-mgmt-storage/_meta.json +++ b/sdk/storage/azure-mgmt-storage/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "cfa9e0f3df4553767d7915ec8f471ff7d4931ed1", + "commit": "70f65ba2d469a2da6b8ab1c5c96bf703c283c8eb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/storage/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/storage/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", "readme": "specification/storage/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_configuration.py index 4f43cb650d31..9fd62cfe9c0c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py index 8a5a61e9f4ff..32828b7cba73 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -56,7 +55,7 @@ class StorageManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-06-01' + DEFAULT_API_VERSION = '2021-08-01' _PROFILE_TAG = "azure.mgmt.storage.StorageManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -71,12 +70,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - if not base_url: - base_url = 'https://management.azure.com' self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(StorageManagementClient, self).__init__( @@ -108,6 +105,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-02-01: :mod:`v2021_02_01.models` * 2021-04-01: :mod:`v2021_04_01.models` * 2021-06-01: :mod:`v2021_06_01.models` + * 2021-08-01: :mod:`v2021_08_01.models` """ if api_version == '2015-06-15': from .v2015_06_15 import models @@ -157,6 +155,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01': from .v2021_06_01 import models return models + elif api_version == '2021-08-01': + from .v2021_08_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -174,6 +175,7 @@ def blob_containers(self): * 2021-02-01: :class:`BlobContainersOperations` * 2021-04-01: :class:`BlobContainersOperations` * 2021-06-01: :class:`BlobContainersOperations` + * 2021-08-01: :class:`BlobContainersOperations` """ api_version = self._get_api_version('blob_containers') if api_version == '2018-02-01': @@ -198,6 +200,8 @@ def blob_containers(self): from .v2021_04_01.operations import BlobContainersOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import BlobContainersOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import BlobContainersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'blob_containers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -212,6 +216,7 @@ def blob_inventory_policies(self): * 2021-02-01: :class:`BlobInventoryPoliciesOperations` * 2021-04-01: :class:`BlobInventoryPoliciesOperations` * 2021-06-01: :class:`BlobInventoryPoliciesOperations` + * 2021-08-01: :class:`BlobInventoryPoliciesOperations` """ api_version = self._get_api_version('blob_inventory_policies') if api_version == '2019-06-01': @@ -226,6 +231,8 @@ def blob_inventory_policies(self): from .v2021_04_01.operations import BlobInventoryPoliciesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import BlobInventoryPoliciesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import BlobInventoryPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'blob_inventory_policies'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,6 +250,7 @@ def blob_services(self): * 2021-02-01: :class:`BlobServicesOperations` * 2021-04-01: :class:`BlobServicesOperations` * 2021-06-01: :class:`BlobServicesOperations` + * 2021-08-01: :class:`BlobServicesOperations` """ api_version = self._get_api_version('blob_services') if api_version == '2018-07-01': @@ -263,6 +271,8 @@ def blob_services(self): from .v2021_04_01.operations import BlobServicesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import BlobServicesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import BlobServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'blob_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -276,6 +286,7 @@ def deleted_accounts(self): * 2021-02-01: :class:`DeletedAccountsOperations` * 2021-04-01: :class:`DeletedAccountsOperations` * 2021-06-01: :class:`DeletedAccountsOperations` + * 2021-08-01: :class:`DeletedAccountsOperations` """ api_version = self._get_api_version('deleted_accounts') if api_version == '2020-08-01-preview': @@ -288,6 +299,8 @@ def deleted_accounts(self): from .v2021_04_01.operations import DeletedAccountsOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import DeletedAccountsOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import DeletedAccountsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deleted_accounts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -302,6 +315,7 @@ def encryption_scopes(self): * 2021-02-01: :class:`EncryptionScopesOperations` * 2021-04-01: :class:`EncryptionScopesOperations` * 2021-06-01: :class:`EncryptionScopesOperations` + * 2021-08-01: :class:`EncryptionScopesOperations` """ api_version = self._get_api_version('encryption_scopes') if api_version == '2019-06-01': @@ -316,6 +330,8 @@ def encryption_scopes(self): from .v2021_04_01.operations import EncryptionScopesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import EncryptionScopesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import EncryptionScopesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'encryption_scopes'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -331,6 +347,7 @@ def file_services(self): * 2021-02-01: :class:`FileServicesOperations` * 2021-04-01: :class:`FileServicesOperations` * 2021-06-01: :class:`FileServicesOperations` + * 2021-08-01: :class:`FileServicesOperations` """ api_version = self._get_api_version('file_services') if api_version == '2019-04-01': @@ -347,6 +364,8 @@ def file_services(self): from .v2021_04_01.operations import FileServicesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import FileServicesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import FileServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'file_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -362,6 +381,7 @@ def file_shares(self): * 2021-02-01: :class:`FileSharesOperations` * 2021-04-01: :class:`FileSharesOperations` * 2021-06-01: :class:`FileSharesOperations` + * 2021-08-01: :class:`FileSharesOperations` """ api_version = self._get_api_version('file_shares') if api_version == '2019-04-01': @@ -378,10 +398,25 @@ def file_shares(self): from .v2021_04_01.operations import FileSharesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import FileSharesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import FileSharesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'file_shares'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def local_users(self): + """Instance depends on the API version: + + * 2021-08-01: :class:`LocalUsersOperations` + """ + api_version = self._get_api_version('local_users') + if api_version == '2021-08-01': + from .v2021_08_01.operations import LocalUsersOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'local_users'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def management_policies(self): """Instance depends on the API version: @@ -395,6 +430,7 @@ def management_policies(self): * 2021-02-01: :class:`ManagementPoliciesOperations` * 2021-04-01: :class:`ManagementPoliciesOperations` * 2021-06-01: :class:`ManagementPoliciesOperations` + * 2021-08-01: :class:`ManagementPoliciesOperations` """ api_version = self._get_api_version('management_policies') if api_version == '2018-07-01': @@ -415,6 +451,8 @@ def management_policies(self): from .v2021_04_01.operations import ManagementPoliciesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import ManagementPoliciesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import ManagementPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'management_policies'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -429,6 +467,7 @@ def object_replication_policies(self): * 2021-02-01: :class:`ObjectReplicationPoliciesOperations` * 2021-04-01: :class:`ObjectReplicationPoliciesOperations` * 2021-06-01: :class:`ObjectReplicationPoliciesOperations` + * 2021-08-01: :class:`ObjectReplicationPoliciesOperations` """ api_version = self._get_api_version('object_replication_policies') if api_version == '2019-06-01': @@ -443,6 +482,8 @@ def object_replication_policies(self): from .v2021_04_01.operations import ObjectReplicationPoliciesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import ObjectReplicationPoliciesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import ObjectReplicationPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'object_replication_policies'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -464,6 +505,7 @@ def operations(self): * 2021-02-01: :class:`Operations` * 2021-04-01: :class:`Operations` * 2021-06-01: :class:`Operations` + * 2021-08-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-06-01': @@ -492,6 +534,8 @@ def operations(self): from .v2021_04_01.operations import Operations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import Operations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -506,6 +550,7 @@ def private_endpoint_connections(self): * 2021-02-01: :class:`PrivateEndpointConnectionsOperations` * 2021-04-01: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-08-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-06-01': @@ -520,6 +565,8 @@ def private_endpoint_connections(self): from .v2021_04_01.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -534,6 +581,7 @@ def private_link_resources(self): * 2021-02-01: :class:`PrivateLinkResourcesOperations` * 2021-04-01: :class:`PrivateLinkResourcesOperations` * 2021-06-01: :class:`PrivateLinkResourcesOperations` + * 2021-08-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2019-06-01': @@ -548,6 +596,8 @@ def private_link_resources(self): from .v2021_04_01.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -562,6 +612,7 @@ def queue(self): * 2021-02-01: :class:`QueueOperations` * 2021-04-01: :class:`QueueOperations` * 2021-06-01: :class:`QueueOperations` + * 2021-08-01: :class:`QueueOperations` """ api_version = self._get_api_version('queue') if api_version == '2019-06-01': @@ -576,6 +627,8 @@ def queue(self): from .v2021_04_01.operations import QueueOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import QueueOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import QueueOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'queue'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -590,6 +643,7 @@ def queue_services(self): * 2021-02-01: :class:`QueueServicesOperations` * 2021-04-01: :class:`QueueServicesOperations` * 2021-06-01: :class:`QueueServicesOperations` + * 2021-08-01: :class:`QueueServicesOperations` """ api_version = self._get_api_version('queue_services') if api_version == '2019-06-01': @@ -604,6 +658,8 @@ def queue_services(self): from .v2021_04_01.operations import QueueServicesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import QueueServicesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import QueueServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'queue_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -625,6 +681,7 @@ def skus(self): * 2021-02-01: :class:`SkusOperations` * 2021-04-01: :class:`SkusOperations` * 2021-06-01: :class:`SkusOperations` + * 2021-08-01: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2017-06-01': @@ -653,6 +710,8 @@ def skus(self): from .v2021_04_01.operations import SkusOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import SkusOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -677,6 +736,7 @@ def storage_accounts(self): * 2021-02-01: :class:`StorageAccountsOperations` * 2021-04-01: :class:`StorageAccountsOperations` * 2021-06-01: :class:`StorageAccountsOperations` + * 2021-08-01: :class:`StorageAccountsOperations` """ api_version = self._get_api_version('storage_accounts') if api_version == '2015-06-15': @@ -711,6 +771,8 @@ def storage_accounts(self): from .v2021_04_01.operations import StorageAccountsOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import StorageAccountsOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import StorageAccountsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storage_accounts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -725,6 +787,7 @@ def table(self): * 2021-02-01: :class:`TableOperations` * 2021-04-01: :class:`TableOperations` * 2021-06-01: :class:`TableOperations` + * 2021-08-01: :class:`TableOperations` """ api_version = self._get_api_version('table') if api_version == '2019-06-01': @@ -739,6 +802,8 @@ def table(self): from .v2021_04_01.operations import TableOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import TableOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import TableOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'table'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -753,6 +818,7 @@ def table_services(self): * 2021-02-01: :class:`TableServicesOperations` * 2021-04-01: :class:`TableServicesOperations` * 2021-06-01: :class:`TableServicesOperations` + * 2021-08-01: :class:`TableServicesOperations` """ api_version = self._get_api_version('table_services') if api_version == '2019-06-01': @@ -767,6 +833,8 @@ def table_services(self): from .v2021_04_01.operations import TableServicesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import TableServicesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import TableServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'table_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -813,6 +881,7 @@ def usages(self): * 2021-02-01: :class:`UsagesOperations` * 2021-04-01: :class:`UsagesOperations` * 2021-06-01: :class:`UsagesOperations` + * 2021-08-01: :class:`UsagesOperations` """ api_version = self._get_api_version('usages') if api_version == '2018-03-01-preview': @@ -835,6 +904,8 @@ def usages(self): from .v2021_04_01.operations import UsagesOperations as OperationClass elif api_version == '2021-06-01': from .v2021_06_01.operations import UsagesOperations as OperationClass + elif api_version == '2021-08-01': + from .v2021_08_01.operations import UsagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'usages'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_configuration.py index 1ef5169b66ec..3ee0c9646eb4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py index f4381b05dccf..b24c36bb24a2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -54,7 +54,7 @@ class StorageManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-06-01' + DEFAULT_API_VERSION = '2021-08-01' _PROFILE_TAG = "azure.mgmt.storage.StorageManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -69,12 +69,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(StorageManagementClient, self).__init__( @@ -106,6 +104,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-02-01: :mod:`v2021_02_01.models` * 2021-04-01: :mod:`v2021_04_01.models` * 2021-06-01: :mod:`v2021_06_01.models` + * 2021-08-01: :mod:`v2021_08_01.models` """ if api_version == '2015-06-15': from ..v2015_06_15 import models @@ -155,6 +154,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01': from ..v2021_06_01 import models return models + elif api_version == '2021-08-01': + from ..v2021_08_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -172,6 +174,7 @@ def blob_containers(self): * 2021-02-01: :class:`BlobContainersOperations` * 2021-04-01: :class:`BlobContainersOperations` * 2021-06-01: :class:`BlobContainersOperations` + * 2021-08-01: :class:`BlobContainersOperations` """ api_version = self._get_api_version('blob_containers') if api_version == '2018-02-01': @@ -196,6 +199,8 @@ def blob_containers(self): from ..v2021_04_01.aio.operations import BlobContainersOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import BlobContainersOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import BlobContainersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'blob_containers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -210,6 +215,7 @@ def blob_inventory_policies(self): * 2021-02-01: :class:`BlobInventoryPoliciesOperations` * 2021-04-01: :class:`BlobInventoryPoliciesOperations` * 2021-06-01: :class:`BlobInventoryPoliciesOperations` + * 2021-08-01: :class:`BlobInventoryPoliciesOperations` """ api_version = self._get_api_version('blob_inventory_policies') if api_version == '2019-06-01': @@ -224,6 +230,8 @@ def blob_inventory_policies(self): from ..v2021_04_01.aio.operations import BlobInventoryPoliciesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import BlobInventoryPoliciesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import BlobInventoryPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'blob_inventory_policies'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -241,6 +249,7 @@ def blob_services(self): * 2021-02-01: :class:`BlobServicesOperations` * 2021-04-01: :class:`BlobServicesOperations` * 2021-06-01: :class:`BlobServicesOperations` + * 2021-08-01: :class:`BlobServicesOperations` """ api_version = self._get_api_version('blob_services') if api_version == '2018-07-01': @@ -261,6 +270,8 @@ def blob_services(self): from ..v2021_04_01.aio.operations import BlobServicesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import BlobServicesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import BlobServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'blob_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -274,6 +285,7 @@ def deleted_accounts(self): * 2021-02-01: :class:`DeletedAccountsOperations` * 2021-04-01: :class:`DeletedAccountsOperations` * 2021-06-01: :class:`DeletedAccountsOperations` + * 2021-08-01: :class:`DeletedAccountsOperations` """ api_version = self._get_api_version('deleted_accounts') if api_version == '2020-08-01-preview': @@ -286,6 +298,8 @@ def deleted_accounts(self): from ..v2021_04_01.aio.operations import DeletedAccountsOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import DeletedAccountsOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import DeletedAccountsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deleted_accounts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -300,6 +314,7 @@ def encryption_scopes(self): * 2021-02-01: :class:`EncryptionScopesOperations` * 2021-04-01: :class:`EncryptionScopesOperations` * 2021-06-01: :class:`EncryptionScopesOperations` + * 2021-08-01: :class:`EncryptionScopesOperations` """ api_version = self._get_api_version('encryption_scopes') if api_version == '2019-06-01': @@ -314,6 +329,8 @@ def encryption_scopes(self): from ..v2021_04_01.aio.operations import EncryptionScopesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import EncryptionScopesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import EncryptionScopesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'encryption_scopes'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -329,6 +346,7 @@ def file_services(self): * 2021-02-01: :class:`FileServicesOperations` * 2021-04-01: :class:`FileServicesOperations` * 2021-06-01: :class:`FileServicesOperations` + * 2021-08-01: :class:`FileServicesOperations` """ api_version = self._get_api_version('file_services') if api_version == '2019-04-01': @@ -345,6 +363,8 @@ def file_services(self): from ..v2021_04_01.aio.operations import FileServicesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import FileServicesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import FileServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'file_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -360,6 +380,7 @@ def file_shares(self): * 2021-02-01: :class:`FileSharesOperations` * 2021-04-01: :class:`FileSharesOperations` * 2021-06-01: :class:`FileSharesOperations` + * 2021-08-01: :class:`FileSharesOperations` """ api_version = self._get_api_version('file_shares') if api_version == '2019-04-01': @@ -376,10 +397,25 @@ def file_shares(self): from ..v2021_04_01.aio.operations import FileSharesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import FileSharesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import FileSharesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'file_shares'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def local_users(self): + """Instance depends on the API version: + + * 2021-08-01: :class:`LocalUsersOperations` + """ + api_version = self._get_api_version('local_users') + if api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import LocalUsersOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'local_users'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def management_policies(self): """Instance depends on the API version: @@ -393,6 +429,7 @@ def management_policies(self): * 2021-02-01: :class:`ManagementPoliciesOperations` * 2021-04-01: :class:`ManagementPoliciesOperations` * 2021-06-01: :class:`ManagementPoliciesOperations` + * 2021-08-01: :class:`ManagementPoliciesOperations` """ api_version = self._get_api_version('management_policies') if api_version == '2018-07-01': @@ -413,6 +450,8 @@ def management_policies(self): from ..v2021_04_01.aio.operations import ManagementPoliciesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import ManagementPoliciesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import ManagementPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'management_policies'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -427,6 +466,7 @@ def object_replication_policies(self): * 2021-02-01: :class:`ObjectReplicationPoliciesOperations` * 2021-04-01: :class:`ObjectReplicationPoliciesOperations` * 2021-06-01: :class:`ObjectReplicationPoliciesOperations` + * 2021-08-01: :class:`ObjectReplicationPoliciesOperations` """ api_version = self._get_api_version('object_replication_policies') if api_version == '2019-06-01': @@ -441,6 +481,8 @@ def object_replication_policies(self): from ..v2021_04_01.aio.operations import ObjectReplicationPoliciesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import ObjectReplicationPoliciesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import ObjectReplicationPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'object_replication_policies'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -462,6 +504,7 @@ def operations(self): * 2021-02-01: :class:`Operations` * 2021-04-01: :class:`Operations` * 2021-06-01: :class:`Operations` + * 2021-08-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-06-01': @@ -490,6 +533,8 @@ def operations(self): from ..v2021_04_01.aio.operations import Operations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import Operations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -504,6 +549,7 @@ def private_endpoint_connections(self): * 2021-02-01: :class:`PrivateEndpointConnectionsOperations` * 2021-04-01: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-08-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-06-01': @@ -518,6 +564,8 @@ def private_endpoint_connections(self): from ..v2021_04_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -532,6 +580,7 @@ def private_link_resources(self): * 2021-02-01: :class:`PrivateLinkResourcesOperations` * 2021-04-01: :class:`PrivateLinkResourcesOperations` * 2021-06-01: :class:`PrivateLinkResourcesOperations` + * 2021-08-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2019-06-01': @@ -546,6 +595,8 @@ def private_link_resources(self): from ..v2021_04_01.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -560,6 +611,7 @@ def queue(self): * 2021-02-01: :class:`QueueOperations` * 2021-04-01: :class:`QueueOperations` * 2021-06-01: :class:`QueueOperations` + * 2021-08-01: :class:`QueueOperations` """ api_version = self._get_api_version('queue') if api_version == '2019-06-01': @@ -574,6 +626,8 @@ def queue(self): from ..v2021_04_01.aio.operations import QueueOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import QueueOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import QueueOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'queue'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -588,6 +642,7 @@ def queue_services(self): * 2021-02-01: :class:`QueueServicesOperations` * 2021-04-01: :class:`QueueServicesOperations` * 2021-06-01: :class:`QueueServicesOperations` + * 2021-08-01: :class:`QueueServicesOperations` """ api_version = self._get_api_version('queue_services') if api_version == '2019-06-01': @@ -602,6 +657,8 @@ def queue_services(self): from ..v2021_04_01.aio.operations import QueueServicesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import QueueServicesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import QueueServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'queue_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -623,6 +680,7 @@ def skus(self): * 2021-02-01: :class:`SkusOperations` * 2021-04-01: :class:`SkusOperations` * 2021-06-01: :class:`SkusOperations` + * 2021-08-01: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2017-06-01': @@ -651,6 +709,8 @@ def skus(self): from ..v2021_04_01.aio.operations import SkusOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import SkusOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -675,6 +735,7 @@ def storage_accounts(self): * 2021-02-01: :class:`StorageAccountsOperations` * 2021-04-01: :class:`StorageAccountsOperations` * 2021-06-01: :class:`StorageAccountsOperations` + * 2021-08-01: :class:`StorageAccountsOperations` """ api_version = self._get_api_version('storage_accounts') if api_version == '2015-06-15': @@ -709,6 +770,8 @@ def storage_accounts(self): from ..v2021_04_01.aio.operations import StorageAccountsOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import StorageAccountsOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import StorageAccountsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storage_accounts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -723,6 +786,7 @@ def table(self): * 2021-02-01: :class:`TableOperations` * 2021-04-01: :class:`TableOperations` * 2021-06-01: :class:`TableOperations` + * 2021-08-01: :class:`TableOperations` """ api_version = self._get_api_version('table') if api_version == '2019-06-01': @@ -737,6 +801,8 @@ def table(self): from ..v2021_04_01.aio.operations import TableOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import TableOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import TableOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'table'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -751,6 +817,7 @@ def table_services(self): * 2021-02-01: :class:`TableServicesOperations` * 2021-04-01: :class:`TableServicesOperations` * 2021-06-01: :class:`TableServicesOperations` + * 2021-08-01: :class:`TableServicesOperations` """ api_version = self._get_api_version('table_services') if api_version == '2019-06-01': @@ -765,6 +832,8 @@ def table_services(self): from ..v2021_04_01.aio.operations import TableServicesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import TableServicesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import TableServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'table_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -811,6 +880,7 @@ def usages(self): * 2021-02-01: :class:`UsagesOperations` * 2021-04-01: :class:`UsagesOperations` * 2021-06-01: :class:`UsagesOperations` + * 2021-08-01: :class:`UsagesOperations` """ api_version = self._get_api_version('usages') if api_version == '2018-03-01-preview': @@ -833,6 +903,8 @@ def usages(self): from ..v2021_04_01.aio.operations import UsagesOperations as OperationClass elif api_version == '2021-06-01': from ..v2021_06_01.aio.operations import UsagesOperations as OperationClass + elif api_version == '2021-08-01': + from ..v2021_08_01.aio.operations import UsagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'usages'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py index 60a2d2a8e47e..7f9c1caee1bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- from .v2018_02_01.models import * -from .v2021_06_01.models import * +from .v2021_08_01.models import * diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py index 82424ef13154..b1e55270b061 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagement'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py index 7927fed4220b..fd310faa779e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json index 998efaaaf4cb..a93001c0fc16 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagement", "filename": "_storage_management", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementConfiguration\"]}}, \"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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "storage_accounts": "StorageAccountsOperations", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py index 43c7f7af9233..056e84f5b9bd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementConfiguration +from .operations import StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementConfiguration -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from . import models - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations @@ -33,52 +30,58 @@ class StorageManagement(object): :vartype usage: azure.mgmt.storage.v2015_06_15.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py index 5bd005704dd7..95bb9e0d6b2c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management import StorageManagement __all__ = ['StorageManagement'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py index 143c41995801..f084495f1d55 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py index d3c0db37f377..32852864a1b5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py @@ -6,75 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementConfiguration +from .operations import StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementConfiguration -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .. import models - - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2015_06_15.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2015_06_15.aio.operations.StorageAccountsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.storage.v2015_06_15.aio.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py index 1f268c402268..e612fa80a4eb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2015_06_15.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2015_06_15.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -318,27 +305,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,8 +329,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -389,32 +369,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +398,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -438,8 +411,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -447,34 +422,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,11 +462,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -509,8 +481,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -518,35 +492,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -564,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -594,27 +566,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +590,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -647,7 +612,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2015_06_15.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountKeys, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountKeys @@ -658,32 +624,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,4 +653,6 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py index d9f8fdb6dbcc..aeae13f705f9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2015_06_15.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2015_06_15.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py index 73de919af9bf..35b2382afcfd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py @@ -6,36 +6,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Endpoints - from ._models_py3 import Resource - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKeys - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName -except (SyntaxError, ImportError): - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Endpoints # type: ignore - from ._models import Resource # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKeys # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Endpoints +from ._models_py3 import Resource +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKeys +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName + from ._storage_management_enums import ( AccountStatus, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models.py deleted file mode 100644 index da3177373b8f..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models.py +++ /dev/null @@ -1,493 +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 msrest.serialization - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - :param name_available: Boolean value that indicates whether the name is available for you to - use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :type name_available: bool - :param reason: The reason that a storage account name could not be used. The Reason element is - only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :type reason: str or ~azure.mgmt.storage.v2015_06_15.models.Reason - :param message: The error message explaining the Reason value in more detail. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The custom domain name. Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue or table object. - - :param blob: The blob endpoint. - :type blob: str - :param queue: The queue endpoint. - :type queue: str - :param table: The table endpoint. - :type table: str - :param file: The file endpoint. - :type file: str - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.queue = kwargs.get('queue', None) - self.table = kwargs.get('table', None) - self.file = kwargs.get('file', None) - - -class Resource(msrest.serialization.Model): - """Describes a storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class StorageAccount(Resource): - """The storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param provisioning_state: The status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :type provisioning_state: str or ~azure.mgmt.storage.v2015_06_15.models.ProvisioningState - :param account_type: The type of the storage account. Possible values include: "Standard_LRS", - "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType - :param primary_endpoints: The URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :type primary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints - :param primary_location: The location of the primary data center for the storage account. - :type primary_location: str - :param status_of_primary: The status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "Available", "Unavailable". - :type status_of_primary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus - :param last_geo_failover_time: The timestamp of the most recent instance of a failover to the - secondary location. Only the most recent timestamp is retained. This element is not returned if - there has never been a failover instance. Only available if the accountType is Standard_GRS or - Standard_RAGRS. - :type last_geo_failover_time: ~datetime.datetime - :param secondary_location: The location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :type secondary_location: str - :param status_of_secondary: The status indicating whether the secondary location of the storage - account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "Available", "Unavailable". - :type status_of_secondary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus - :param creation_time: The creation date and time of the storage account in UTC. - :type creation_time: ~datetime.datetime - :param custom_domain: The custom domain the user assigned to this storage account. - :type custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain - :param secondary_endpoints: The URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :type secondary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.account_type = kwargs.get('account_type', None) - self.primary_endpoints = kwargs.get('primary_endpoints', None) - self.primary_location = kwargs.get('primary_location', None) - self.status_of_primary = kwargs.get('status_of_primary', None) - self.last_geo_failover_time = kwargs.get('last_geo_failover_time', None) - self.secondary_location = kwargs.get('secondary_location', None) - self.status_of_secondary = kwargs.get('status_of_secondary', None) - self.creation_time = kwargs.get('creation_time', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.secondary_endpoints = kwargs.get('secondary_endpoints', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. - :type name: str - :param type: - :type type: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs.get('type', "Microsoft.Storage/storageAccounts") - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters to provide for the account. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The location of the resource. This will be one of the supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a - resource cannot be changed once it is created, but if an identical geo region is specified on - update, the request will succeed. - :type location: str - :param tags: A set of tags. A list of key value pairs that describe the resource. These tags - can be used for viewing and grouping this resource (across resource groups). A maximum of 15 - tags can be provided for a resource. Each tag must have a key with a length no greater than 128 - characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param account_type: The sku name. Required for account creation; optional for update. Note - that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.account_type = kwargs.get('account_type', None) - - -class StorageAccountKeys(msrest.serialization.Model): - """The access keys for the storage account. - - :param key1: The value of key 1. - :type key1: str - :param key2: The value of key 2. - :type key2: str - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKeys, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) - - -class StorageAccountListResult(msrest.serialization.Model): - """The list storage accounts operation response. - - :param value: The list of storage accounts and their properties. - :type value: list[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters to update on the account. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param account_type: The account type. Note that StandardZRS and PremiumLRS accounts cannot be - changed to other account types, and other account types cannot be changed to StandardZRS or - PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", - "Standard_RAGRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.account_type = kwargs.get('account_type', None) - self.custom_domain = kwargs.get('custom_domain', None) - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - All required parameters must be populated in order to send to Azure. - - :param unit: Required. The unit of measurement. Possible values include: "Count", "Bytes", - "Seconds", "Percent", "CountsPerSecond", "BytesPerSecond". - :type unit: str or ~azure.mgmt.storage.v2015_06_15.models.UsageUnit - :param current_value: Required. The current count of the allocated resources in the - subscription. - :type current_value: int - :param limit: Required. The maximum count of the resources that can be allocated in the - subscription. - :type limit: int - :param name: Required. The name of the type of usage. - :type name: ~azure.mgmt.storage.v2015_06_15.models.UsageName - """ - - _validation = { - 'unit': {'required': True}, - 'current_value': {'required': True}, - 'limit': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = kwargs['unit'] - self.current_value = kwargs['current_value'] - self.limit = kwargs['limit'] - self.name = kwargs['name'] - - -class UsageListResult(msrest.serialization.Model): - """The List Usages operation response. - - :param value: The list Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2015_06_15.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The Usage Names. - - :param value: A string describing the resource name. - :type value: str - :param localized_value: A localized string describing the resource name. - :type localized_value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.localized_value = kwargs.get('localized_value', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py index fb9488ef94b6..a58a35e72490 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py @@ -17,16 +17,16 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - :param name_available: Boolean value that indicates whether the name is available for you to + :ivar name_available: Boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. - :type name_available: bool - :param reason: The reason that a storage account name could not be used. The Reason element is + :vartype name_available: bool + :ivar reason: The reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.storage.v2015_06_15.models.Reason - :param message: The error message explaining the Reason value in more detail. - :type message: str + :vartype reason: str or ~azure.mgmt.storage.v2015_06_15.models.Reason + :ivar message: The error message explaining the Reason value in more detail. + :vartype message: str """ _attribute_map = { @@ -43,6 +43,18 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. + :paramtype name_available: bool + :keyword reason: The reason that a storage account name could not be used. The Reason element + is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.storage.v2015_06_15.models.Reason + :keyword message: The error message explaining the Reason value in more detail. + :paramtype message: str + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -54,11 +66,11 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The custom domain name. Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. The custom domain name. Name is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -77,6 +89,13 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. The custom domain name. Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -85,14 +104,14 @@ def __init__( class Endpoints(msrest.serialization.Model): """The URIs that are used to perform a retrieval of a public blob, queue or table object. - :param blob: The blob endpoint. - :type blob: str - :param queue: The queue endpoint. - :type queue: str - :param table: The table endpoint. - :type table: str - :param file: The file endpoint. - :type file: str + :ivar blob: The blob endpoint. + :vartype blob: str + :ivar queue: The queue endpoint. + :vartype queue: str + :ivar table: The table endpoint. + :vartype table: str + :ivar file: The file endpoint. + :vartype file: str """ _attribute_map = { @@ -111,6 +130,16 @@ def __init__( file: Optional[str] = None, **kwargs ): + """ + :keyword blob: The blob endpoint. + :paramtype blob: str + :keyword queue: The queue endpoint. + :paramtype queue: str + :keyword table: The table endpoint. + :paramtype table: str + :keyword file: The file endpoint. + :paramtype file: str + """ super(Endpoints, self).__init__(**kwargs) self.blob = blob self.queue = queue @@ -129,10 +158,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -156,6 +185,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -175,45 +210,44 @@ class StorageAccount(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param provisioning_state: The status of the storage account at the time the operation was + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar provisioning_state: The status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :type provisioning_state: str or ~azure.mgmt.storage.v2015_06_15.models.ProvisioningState - :param account_type: The type of the storage account. Possible values include: "Standard_LRS", + :vartype provisioning_state: str or ~azure.mgmt.storage.v2015_06_15.models.ProvisioningState + :ivar account_type: The type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType - :param primary_endpoints: The URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :type primary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints - :param primary_location: The location of the primary data center for the storage account. - :type primary_location: str - :param status_of_primary: The status indicating whether the primary location of the storage + :vartype account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType + :ivar primary_endpoints: The URLs that are used to perform a retrieval of a public blob, queue, + or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob endpoint. + :vartype primary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints + :ivar primary_location: The location of the primary data center for the storage account. + :vartype primary_location: str + :ivar status_of_primary: The status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - :type status_of_primary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus - :param last_geo_failover_time: The timestamp of the most recent instance of a failover to the + :vartype status_of_primary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus + :ivar last_geo_failover_time: The timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :type last_geo_failover_time: ~datetime.datetime - :param secondary_location: The location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :type secondary_location: str - :param status_of_secondary: The status indicating whether the secondary location of the storage + :vartype last_geo_failover_time: ~datetime.datetime + :ivar secondary_location: The location of the geo-replicated secondary for the storage account. + Only available if the accountType is Standard_GRS or Standard_RAGRS. + :vartype secondary_location: str + :ivar status_of_secondary: The status indicating whether the secondary location of the storage account is available or unavailable. Only available if the SKU name is Standard_GRS or Standard_RAGRS. Possible values include: "Available", "Unavailable". - :type status_of_secondary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus - :param creation_time: The creation date and time of the storage account in UTC. - :type creation_time: ~datetime.datetime - :param custom_domain: The custom domain the user assigned to this storage account. - :type custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain - :param secondary_endpoints: The URLs that are used to perform a retrieval of a public blob, + :vartype status_of_secondary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus + :ivar creation_time: The creation date and time of the storage account in UTC. + :vartype creation_time: ~datetime.datetime + :ivar custom_domain: The custom domain the user assigned to this storage account. + :vartype custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain + :ivar secondary_endpoints: The URLs that are used to perform a retrieval of a public blob, queue, or table object from the secondary location of the storage account. Only available if the SKU name is Standard_RAGRS. - :type secondary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints + :vartype secondary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints """ _validation = { @@ -259,6 +293,47 @@ def __init__( secondary_endpoints: Optional["Endpoints"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword provisioning_state: The status of the storage account at the time the operation was + called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + :paramtype provisioning_state: str or ~azure.mgmt.storage.v2015_06_15.models.ProvisioningState + :keyword account_type: The type of the storage account. Possible values include: + "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + :paramtype account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType + :keyword primary_endpoints: The URLs that are used to perform a retrieval of a public blob, + queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob + endpoint. + :paramtype primary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints + :keyword primary_location: The location of the primary data center for the storage account. + :paramtype primary_location: str + :keyword status_of_primary: The status indicating whether the primary location of the storage + account is available or unavailable. Possible values include: "Available", "Unavailable". + :paramtype status_of_primary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus + :keyword last_geo_failover_time: The timestamp of the most recent instance of a failover to the + secondary location. Only the most recent timestamp is retained. This element is not returned if + there has never been a failover instance. Only available if the accountType is Standard_GRS or + Standard_RAGRS. + :paramtype last_geo_failover_time: ~datetime.datetime + :keyword secondary_location: The location of the geo-replicated secondary for the storage + account. Only available if the accountType is Standard_GRS or Standard_RAGRS. + :paramtype secondary_location: str + :keyword status_of_secondary: The status indicating whether the secondary location of the + storage account is available or unavailable. Only available if the SKU name is Standard_GRS or + Standard_RAGRS. Possible values include: "Available", "Unavailable". + :paramtype status_of_secondary: str or ~azure.mgmt.storage.v2015_06_15.models.AccountStatus + :keyword creation_time: The creation date and time of the storage account in UTC. + :paramtype creation_time: ~datetime.datetime + :keyword custom_domain: The custom domain the user assigned to this storage account. + :paramtype custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain + :keyword secondary_endpoints: The URLs that are used to perform a retrieval of a public blob, + queue, or table object from the secondary location of the storage account. Only available if + the SKU name is Standard_RAGRS. + :paramtype secondary_endpoints: ~azure.mgmt.storage.v2015_06_15.models.Endpoints + """ super(StorageAccount, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = provisioning_state self.account_type = account_type @@ -278,10 +353,10 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param type: - :type type: str + :ivar name: Required. + :vartype name: str + :ivar type: + :vartype type: str """ _validation = { @@ -300,6 +375,12 @@ def __init__( type: Optional[str] = "Microsoft.Storage/storageAccounts", **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword type: + :paramtype type: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name self.type = type @@ -310,20 +391,20 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The location of the resource. This will be one of the supported and + :ivar location: Required. The location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. A list of key value pairs that describe the resource. These tags - can be used for viewing and grouping this resource (across resource groups). A maximum of 15 - tags can be provided for a resource. Each tag must have a key with a length no greater than 128 + :vartype location: str + :ivar tags: A set of tags. A list of key value pairs that describe the resource. These tags can + be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags + can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param account_type: The sku name. Required for account creation; optional for update. Note - that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType + :vartype tags: dict[str, str] + :ivar account_type: The sku name. Required for account creation; optional for update. Note that + in older versions, sku name was called accountType. Possible values include: "Standard_LRS", + "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + :vartype account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType """ _validation = { @@ -344,6 +425,22 @@ def __init__( account_type: Optional[Union[str, "AccountType"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This will be one of the supported + and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region + of a resource cannot be changed once it is created, but if an identical geo region is specified + on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. A list of key value pairs that describe the resource. These tags + can be used for viewing and grouping this resource (across resource groups). A maximum of 15 + tags can be provided for a resource. Each tag must have a key with a length no greater than 128 + characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword account_type: The sku name. Required for account creation; optional for update. Note + that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + :paramtype account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -353,10 +450,10 @@ def __init__( class StorageAccountKeys(msrest.serialization.Model): """The access keys for the storage account. - :param key1: The value of key 1. - :type key1: str - :param key2: The value of key 2. - :type key2: str + :ivar key1: The value of key 1. + :vartype key1: str + :ivar key2: The value of key 2. + :vartype key2: str """ _attribute_map = { @@ -371,6 +468,12 @@ def __init__( key2: Optional[str] = None, **kwargs ): + """ + :keyword key1: The value of key 1. + :paramtype key1: str + :keyword key2: The value of key 2. + :paramtype key2: str + """ super(StorageAccountKeys, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 @@ -379,8 +482,8 @@ def __init__( class StorageAccountListResult(msrest.serialization.Model): """The list storage accounts operation response. - :param value: The list of storage accounts and their properties. - :type value: list[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] + :ivar value: The list of storage accounts and their properties. + :vartype value: list[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] """ _attribute_map = { @@ -393,6 +496,10 @@ def __init__( value: Optional[List["StorageAccount"]] = None, **kwargs ): + """ + :keyword value: The list of storage accounts and their properties. + :paramtype value: list[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = value @@ -402,8 +509,8 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. - :type key_name: str + :ivar key_name: Required. + :vartype key_name: str """ _validation = { @@ -420,6 +527,10 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -427,17 +538,17 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters to update on the account. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param account_type: The account type. Note that StandardZRS and PremiumLRS accounts cannot be + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar account_type: The account type. Note that StandardZRS and PremiumLRS accounts cannot be changed to other account types, and other account types cannot be changed to StandardZRS or PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - :type account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain + :vartype custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain """ _attribute_map = { @@ -454,6 +565,19 @@ def __init__( custom_domain: Optional["CustomDomain"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword account_type: The account type. Note that StandardZRS and PremiumLRS accounts cannot + be changed to other account types, and other account types cannot be changed to StandardZRS or + PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", + "Standard_RAGRS", "Premium_LRS". + :paramtype account_type: str or ~azure.mgmt.storage.v2015_06_15.models.AccountType + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2015_06_15.models.CustomDomain + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.tags = tags self.account_type = account_type @@ -465,17 +589,17 @@ class Usage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param unit: Required. The unit of measurement. Possible values include: "Count", "Bytes", + :ivar unit: Required. The unit of measurement. Possible values include: "Count", "Bytes", "Seconds", "Percent", "CountsPerSecond", "BytesPerSecond". - :type unit: str or ~azure.mgmt.storage.v2015_06_15.models.UsageUnit - :param current_value: Required. The current count of the allocated resources in the + :vartype unit: str or ~azure.mgmt.storage.v2015_06_15.models.UsageUnit + :ivar current_value: Required. The current count of the allocated resources in the subscription. - :type current_value: int - :param limit: Required. The maximum count of the resources that can be allocated in the + :vartype current_value: int + :ivar limit: Required. The maximum count of the resources that can be allocated in the subscription. - :type limit: int - :param name: Required. The name of the type of usage. - :type name: ~azure.mgmt.storage.v2015_06_15.models.UsageName + :vartype limit: int + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.storage.v2015_06_15.models.UsageName """ _validation = { @@ -501,6 +625,19 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword unit: Required. The unit of measurement. Possible values include: "Count", "Bytes", + "Seconds", "Percent", "CountsPerSecond", "BytesPerSecond". + :paramtype unit: str or ~azure.mgmt.storage.v2015_06_15.models.UsageUnit + :keyword current_value: Required. The current count of the allocated resources in the + subscription. + :paramtype current_value: int + :keyword limit: Required. The maximum count of the resources that can be allocated in the + subscription. + :paramtype limit: int + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.storage.v2015_06_15.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.unit = unit self.current_value = current_value @@ -511,8 +648,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The List Usages operation response. - :param value: The list Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2015_06_15.models.Usage] + :ivar value: The list Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2015_06_15.models.Usage] """ _attribute_map = { @@ -525,6 +662,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: The list Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2015_06_15.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -532,10 +673,10 @@ def __init__( class UsageName(msrest.serialization.Model): """The Usage Names. - :param value: A string describing the resource name. - :type value: str - :param localized_value: A localized string describing the resource name. - :type localized_value: str + :ivar value: A string describing the resource name. + :vartype value: str + :ivar localized_value: A localized string describing the resource name. + :vartype localized_value: str """ _attribute_map = { @@ -550,6 +691,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: A string describing the resource name. + :paramtype value: str + :keyword localized_value: A localized string describing the resource name. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_storage_management_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_storage_management_enums.py index 236a23fc4d42..b275bafa3253 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_storage_management_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_storage_management_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status indicating whether the primary location of the storage account is available or unavailable. """ @@ -34,7 +19,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -45,7 +30,7 @@ class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_RAGRS = "Standard_RAGRS" PREMIUM_LRS = "Premium_LRS" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the storage account at the time the operation was called. """ @@ -53,7 +38,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -61,7 +46,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py index a3cfe7a86128..1903e9f75534 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py @@ -5,25 +5,363 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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 = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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_create_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + 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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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 + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +385,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2015_06_15.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2015_06_15.models.CheckNameAvailabilityResult @@ -69,30 +408,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +435,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +482,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +510,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2015_06_15.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +534,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +560,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +589,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,13 +612,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -327,27 +641,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,16 +665,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -399,32 +705,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,19 +734,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -458,34 +758,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,17 +798,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -521,8 +817,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2015_06_15.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -530,35 +828,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,18 +870,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountKeys" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountKeys": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -607,27 +902,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +926,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountKeys" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountKeys": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -661,7 +948,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2015_06_15.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountKeys, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountKeys @@ -672,32 +960,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,4 +989,6 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py index 874c1311ea5c..d6d112cbb9f8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2015-06-15" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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 UsageOperations(object): """UsageOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Lists the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2015-06-15" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py index 2766e49ce18a..73d28a412b43 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json index b0ff45d32019..bda5a6a227b5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Storage Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "storage_accounts": "StorageAccountsOperations", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py index 3073fff3650c..e55fff2f886c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Storage Management Client. :ivar storage_accounts: StorageAccountsOperations operations @@ -33,52 +30,58 @@ class StorageManagementClient(object): :vartype usage: azure.mgmt.storage.v2016_01_01.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py index 3a99a334bf0b..00c9b33ca782 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py index 7b8955c52371..4171e0334612 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py @@ -6,75 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Storage Management Client. :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2016_01_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2016_01_01.aio.operations.StorageAccountsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.storage.v2016_01_01.aio.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py index 7faa9b1117b9..75df2fc0c534 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2016_01_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_01_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -180,15 +172,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2016_01_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2016_01_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -200,27 +197,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -232,8 +223,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -258,25 +251,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -289,6 +274,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -315,27 +302,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -349,8 +326,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -385,32 +365,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -424,8 +394,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -434,8 +407,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -443,34 +418,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -488,11 +458,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -504,8 +476,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group within the user's subscription. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -513,35 +487,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,11 +529,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -588,27 +560,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -622,8 +584,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -640,7 +605,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2016_01_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountListKeysResult @@ -651,32 +617,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -690,4 +646,6 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py index a7cb247a208a..c3df4e2711b6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_01_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_01_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py index 715b1e7501b5..9c86ce86ec79 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py @@ -6,46 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import Resource - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName -except (SyntaxError, ImportError): - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import Resource # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models.py deleted file mode 100644 index 26863c8864f1..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models.py +++ /dev/null @@ -1,745 +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 msrest.serialization - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2016_01_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2016_01_01.models.EncryptionServices - :ivar key_source: The encryption keySource (provider). Possible values (case-insensitive): - Microsoft.Storage. Has constant value: "Microsoft.Storage". - :vartype key_source: str - """ - - _validation = { - 'key_source': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - } - - key_source = "Microsoft.Storage" - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2016_01_01.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, or table object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - - -class Resource(msrest.serialization.Model): - """Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the sku name. Required for account creation; optional for - update. Note that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2016_01_01.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2016_01_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class StorageAccount(Resource): - """The storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2016_01_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2016_01_01.models.Kind - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2016_01_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2016_01_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "Available", "Unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2016_01_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "Available", "Unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2016_01_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2016_01_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """StorageAccountCheckNameAvailabilityParameters. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. - :type name: str - :ivar type: Has constant value: "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2016_01_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2016_01_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "READ", "FULL". - :vartype permissions: str or ~azure.mgmt.storage.v2016_01_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2016_01_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2016_01_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """StorageAccountRegenerateKeyParameters. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS - or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2016_01_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2016_01_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2016_01_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2016_01_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py index 955e9e189d80..7e4597826a13 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -57,12 +59,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -81,6 +83,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -93,8 +103,8 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2016_01_01.models.EncryptionServices + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2016_01_01.models.EncryptionServices :ivar key_source: The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage. Has constant value: "Microsoft.Storage". :vartype key_source: str @@ -117,6 +127,10 @@ def __init__( services: Optional["EncryptionServices"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2016_01_01.models.EncryptionServices + """ super(Encryption, self).__init__(**kwargs) self.services = services @@ -126,9 +140,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -150,6 +164,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -158,8 +177,8 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2016_01_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2016_01_01.models.EncryptionService """ _attribute_map = { @@ -172,6 +191,10 @@ def __init__( blob: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2016_01_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob @@ -209,6 +232,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -227,11 +252,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] """ _validation = { @@ -255,6 +280,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -270,10 +302,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the sku name. Required for account creation; optional for + :ivar name: Required. Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2016_01_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2016_01_01.models.SkuName :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2016_01_01.models.SkuTier @@ -295,6 +327,12 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. Gets or sets the sku name. Required for account creation; optional for + update. Note that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.storage.v2016_01_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -311,11 +349,11 @@ class StorageAccount(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2016_01_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "BlobStorage". @@ -409,6 +447,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + """ super(StorageAccount, self).__init__(location=location, tags=tags, **kwargs) self.sku = None self.kind = None @@ -433,8 +478,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str + :ivar name: Required. + :vartype name: str :ivar type: Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -457,6 +502,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -466,31 +515,31 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2016_01_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2016_01_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the sku name. + :vartype sku: ~azure.mgmt.storage.v2016_01_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "BlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2016_01_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier + :vartype encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier """ _validation = { @@ -521,6 +570,33 @@ def __init__( access_tier: Optional[Union[str, "AccessTier"]] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the sku name. + :paramtype sku: ~azure.mgmt.storage.v2016_01_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2016_01_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -561,6 +637,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -589,6 +667,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -614,6 +694,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -623,8 +705,8 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. - :type key_name: str + :ivar key_name: Required. + :vartype key_name: str """ _validation = { @@ -641,6 +723,10 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -648,24 +734,24 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2016_01_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype sku: ~azure.mgmt.storage.v2016_01_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype tags: dict[str, str] + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier + :vartype encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier """ _attribute_map = { @@ -686,6 +772,26 @@ def __init__( access_tier: Optional[Union[str, "AccessTier"]] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. + :paramtype sku: ~azure.mgmt.storage.v2016_01_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2016_01_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2016_01_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2016_01_01.models.AccessTier + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -728,6 +834,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -738,8 +846,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2016_01_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2016_01_01.models.Usage] """ _attribute_map = { @@ -752,6 +860,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2016_01_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -781,6 +893,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_storage_management_client_enums.py index 654cb84a2f4d..1b64707c39ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,21 +26,21 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "READ" FULL = "FULL" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required. Indicates the type of storage account. """ STORAGE = "Storage" BLOB_STORAGE = "BlobStorage" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -63,7 +48,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -71,7 +56,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -82,14 +67,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py index 32e8240c5961..880e4d68fdef 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py @@ -5,25 +5,363 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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 = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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_create_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + 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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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 + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +385,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2016_01_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_01_01.models.CheckNameAvailabilityResult @@ -69,30 +408,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +435,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +482,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -187,15 +509,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2016_01_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +533,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -239,15 +559,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. @@ -266,25 +587,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -297,13 +610,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -324,27 +638,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,16 +662,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -395,32 +701,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,19 +730,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +754,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,25 +794,28 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. :param resource_group_name: The name of the resource group within the user's subscription. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +823,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,18 +865,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. @@ -601,27 +896,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -635,16 +920,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. @@ -654,7 +941,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2016_01_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountListKeysResult @@ -665,32 +953,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -704,4 +982,6 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py index 12abbf330c1e..72cd0e0d6e4d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-01-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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 UsageOperations(object): """UsageOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-01-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py index 82424ef13154..b1e55270b061 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagement'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py index 3de31a8ecb13..1d0ba2cd56b5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json index fd86d7ddbe84..a412131b3500 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagement", "filename": "_storage_management", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementConfiguration\"]}}, \"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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "storage_accounts": "StorageAccountsOperations", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py index 772ef59aa115..e20cdb2b45a5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementConfiguration +from .operations import StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementConfiguration -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from . import models - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations @@ -33,52 +30,58 @@ class StorageManagement(object): :vartype usage: azure.mgmt.storage.v2016_12_01.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py index 5bd005704dd7..95bb9e0d6b2c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management import StorageManagement __all__ = ['StorageManagement'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py index b0594d0b4d23..4530a7716a3b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py index 104386ad38fa..d21dcc248666 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py @@ -6,75 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementConfiguration +from .operations import StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementConfiguration -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .. import models - - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2016_12_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2016_12_01.aio.operations.StorageAccountsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.storage.v2016_12_01.aio.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py index c8d9d3971a37..25d69d4d554a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2016_12_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_12_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2016_12_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2016_12_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -318,27 +305,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,8 +329,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -389,32 +369,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +398,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -438,8 +411,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -447,34 +422,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,11 +462,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -509,8 +481,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -518,35 +492,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -564,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -594,27 +566,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +590,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -647,7 +612,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2016_12_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountListKeysResult @@ -658,32 +624,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +653,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -727,32 +686,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccountSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -766,8 +715,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -796,32 +748,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,4 +777,6 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py index f86af2a94548..5b1a91f62142 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_12_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2016_12_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py index 7a4506668a24..4e47b256d7dc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py @@ -6,54 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import Resource - from ._models_py3 import ServiceSasParameters - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import Resource # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import Resource +from ._models_py3 import ServiceSasParameters +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName + from ._storage_management_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models.py deleted file mode 100644 index ccb022c84cda..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models.py +++ /dev/null @@ -1,997 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or - ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedServices - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or - ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or - ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedPermission - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2016_12_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2016_12_01.models.EncryptionServices - :ivar key_source: The encryption keySource (provider). Possible values (case-insensitive): - Microsoft.Storage. Has constant value: "Microsoft.Storage". - :vartype key_source: str - """ - - _validation = { - 'key_source': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - } - - key_source = "Microsoft.Storage" - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, or table object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class Resource(msrest.serialization.Model): - """Describes a storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: Required. The signed services accessible with the service SAS. Possible values - include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", - "s". - :type resource: str or ~azure.mgmt.storage.v2016_12_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2016_12_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs['resource'] - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the sku name. Required for account creation; optional for - update. Note that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2016_12_01.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2016_12_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class StorageAccount(Resource): - """The storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2016_12_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2016_12_01.models.Kind - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2016_12_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2016_12_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2016_12_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2016_12_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2016_12_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. - :type name: str - :ivar type: Has constant value: "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2016_12_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2016_12_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2016_12_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2016_12_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2016_12_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS - or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2016_12_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2016_12_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2016_12_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2016_12_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py index 978707220a8d..74fc9ef657db 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py @@ -19,34 +19,34 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or + :vartype services: str or ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedServices - :param resource_types: Required. The signed resource types that are accessible with the account + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or + :vartype resource_types: str or ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or + :vartype permissions: str or ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedPermission - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -80,6 +80,37 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or + ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedServices + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or + ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or + ~azure.mgmt.storage.v2016_12_01.models.AccountSasParametersSignedPermission + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -124,6 +155,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -135,12 +168,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -159,6 +192,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -171,8 +212,8 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2016_12_01.models.EncryptionServices + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2016_12_01.models.EncryptionServices :ivar key_source: The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage. Has constant value: "Microsoft.Storage". :vartype key_source: str @@ -195,6 +236,10 @@ def __init__( services: Optional["EncryptionServices"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2016_12_01.models.EncryptionServices + """ super(Encryption, self).__init__(**kwargs) self.services = services @@ -204,9 +249,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -228,6 +273,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -238,10 +288,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -267,6 +317,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2016_12_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -307,6 +363,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -335,6 +393,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -360,6 +420,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -375,11 +437,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] """ _validation = { @@ -403,6 +465,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -416,50 +485,49 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: Required. The signed services accessible with the service SAS. Possible values + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: Required. The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2016_12_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2016_12_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2016_12_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2016_12_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -512,6 +580,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: Required. The signed services accessible with the service SAS. Possible + values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", + "c", "f", "s". + :paramtype resource: str or ~azure.mgmt.storage.v2016_12_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2016_12_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2016_12_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -540,10 +654,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the sku name. Required for account creation; optional for + :ivar name: Required. Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2016_12_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2016_12_01.models.SkuName :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2016_12_01.models.SkuTier @@ -565,6 +679,12 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. Gets or sets the sku name. Required for account creation; optional for + update. Note that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.storage.v2016_12_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -581,11 +701,11 @@ class StorageAccount(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2016_12_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "BlobStorage". @@ -628,8 +748,8 @@ class StorageAccount(Resource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool """ _validation = { @@ -683,6 +803,16 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccount, self).__init__(location=location, tags=tags, **kwargs) self.sku = None self.kind = None @@ -708,8 +838,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str + :ivar name: Required. + :vartype name: str :ivar type: Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -732,6 +862,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -741,33 +875,33 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2016_12_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2016_12_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the sku name. + :vartype sku: ~azure.mgmt.storage.v2016_12_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "BlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2016_12_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :vartype encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool """ _validation = { @@ -800,6 +934,36 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the sku name. + :paramtype sku: ~azure.mgmt.storage.v2016_12_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2016_12_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -841,6 +1005,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -869,6 +1035,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -894,6 +1062,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -903,8 +1073,8 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. - :type key_name: str + :ivar key_name: Required. + :vartype key_name: str """ _validation = { @@ -921,6 +1091,10 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -928,26 +1102,26 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2016_12_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype sku: ~azure.mgmt.storage.v2016_12_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype tags: dict[str, str] + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :vartype encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool """ _attribute_map = { @@ -970,6 +1144,29 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. + :paramtype sku: ~azure.mgmt.storage.v2016_12_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2016_12_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2016_12_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2016_12_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -1013,6 +1210,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -1023,8 +1222,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2016_12_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2016_12_01.models.Usage] """ _attribute_map = { @@ -1037,6 +1236,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2016_12_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -1066,6 +1269,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_storage_management_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_storage_management_enums.py index 201fcb17b8b3..c59000b0d3cb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_storage_management_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_storage_management_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountSasParametersSignedPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountSasParametersSignedPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -47,7 +32,7 @@ class AccountSasParametersSignedPermission(with_metaclass(_CaseInsensitiveEnumMe U = "u" P = "p" -class AccountSasParametersSignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountSasParametersSignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -57,7 +42,7 @@ class AccountSasParametersSignedResourceTypes(with_metaclass(_CaseInsensitiveEnu C = "c" O = "o" -class AccountSasParametersSignedServices(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountSasParametersSignedServices(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -67,7 +52,7 @@ class AccountSasParametersSignedServices(with_metaclass(_CaseInsensitiveEnumMeta T = "t" F = "f" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -75,28 +60,28 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required. Indicates the type of storage account. """ STORAGE = "Storage" BLOB_STORAGE = "BlobStorage" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -110,7 +95,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -118,7 +103,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -126,7 +111,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -136,7 +121,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -147,14 +132,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py index 5d6595502c7e..c3da1171d5ab 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py @@ -5,25 +5,451 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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 = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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_create_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + 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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_account_sas_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_service_sas_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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 + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +473,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2016_12_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_12_01.models.CheckNameAvailabilityResult @@ -69,30 +496,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +523,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +570,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +598,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2016_12_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +622,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +648,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +677,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,13 +700,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -327,27 +729,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,16 +753,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -399,32 +793,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,19 +822,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -458,34 +846,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,17 +886,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -521,8 +905,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2016_12_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -530,35 +916,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,18 +958,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -607,27 +990,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +1014,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -661,7 +1036,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2016_12_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountListKeysResult @@ -672,32 +1048,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,16 +1077,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -742,32 +1110,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,16 +1139,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -812,32 +1172,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -851,4 +1201,6 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py index 41da5c54a5d1..cb6a65936bb2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-12-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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 UsageOperations(object): """UsageOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-12-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py index 82424ef13154..b1e55270b061 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagement'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py index e7465ee4800a..67975f9a4bd9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json index 8824bfa844b9..06ff3b25e9b7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagement", "filename": "_storage_management", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementConfiguration\"]}}, \"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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py index 7eeb5b97d7bf..e928784b75fe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementConfiguration +from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from . import models - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -39,56 +34,60 @@ class StorageManagement(object): :vartype usage: azure.mgmt.storage.v2017_06_01.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py index 5bd005704dd7..95bb9e0d6b2c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management import StorageManagement __all__ = ['StorageManagement'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py index d1bce9a43917..75423496d596 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py index 6688603f8fc1..9db018041360 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementConfiguration +from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .. import models - - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -32,59 +29,66 @@ class StorageManagement(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2017_06_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2017_06_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2017_06_01.aio.operations.StorageAccountsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.storage.v2017_06_01.aio.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py index efe606dcfaed..2ab101b653be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py index cc0aa50c9fe0..2ee10b9cb7de 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py index 64d32bee43d8..c4deac383132 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2017_06_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_06_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2017_06_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2017_06_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -318,27 +305,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,8 +329,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -389,32 +369,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +398,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -438,8 +411,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -447,34 +422,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,11 +462,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -509,8 +481,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -518,35 +492,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -564,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -594,27 +566,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +590,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -647,7 +612,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2017_06_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountListKeysResult @@ -658,32 +624,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +653,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -727,32 +686,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccountSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -766,8 +715,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -796,32 +748,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,4 +777,6 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py index f4a58fed7514..971abfc7f82c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_06_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py index c07ac99f870b..f43919086149 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py @@ -6,82 +6,44 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import KeyVaultProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import KeyVaultProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models.py deleted file mode 100644 index d48a55e487cd..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models.py +++ /dev/null @@ -1,1488 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2017_06_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2017_06_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2017_06_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2017_06_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2017_06_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, or table object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2017_06_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2017_06_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2017_06_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2017_06_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2017_06_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2017_06_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2017_06_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2017_06_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Resource(msrest.serialization.Model): - """Describes a storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2017_06_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: Required. The signed services accessible with the service SAS. Possible values - include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", - "s". - :type resource: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs['resource'] - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2017_06_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the sku name. Required for account creation; optional for - update. Note that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2017_06_01.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2017_06_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified sku, including file encryption, - network acls, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2017_06_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2017_06_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified sku, including file encryption, network acls, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified sku, including - file encryption, network acls, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class StorageAccount(Resource): - """The storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2017_06_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_06_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2017_06_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2017_06_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2017_06_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2017_06_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2017_06_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = None - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2017_06_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_06_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2017_06_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2017_06_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2017_06_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS - or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2017_06_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_06_01.models.Identity - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2017_06_01.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2017_06_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2017_06_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2017_06_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2017_06_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py index 1fbc5e0de664..27f9a8a68a2e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py @@ -19,31 +19,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2017_06_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2017_06_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +77,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2017_06_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -121,6 +149,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -132,12 +162,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -156,6 +186,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -164,10 +202,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -182,6 +220,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -192,14 +236,14 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2017_06_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2017_06_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2017_06_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2017_06_01.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2017_06_01.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2017_06_01.models.KeyVaultProperties """ _validation = { @@ -220,6 +264,16 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2017_06_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2017_06_01.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2017_06_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -231,9 +285,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -255,6 +309,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -265,10 +324,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -294,6 +353,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2017_06_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -334,6 +399,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -374,6 +441,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -384,12 +453,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -408,6 +477,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -416,12 +493,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -438,6 +515,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -465,6 +550,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -490,6 +577,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -497,24 +586,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2017_06_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2017_06_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -543,6 +632,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2017_06_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -560,18 +669,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2017_06_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2017_06_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2017_06_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2017_06_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2017_06_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2017_06_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2017_06_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2017_06_01.models.DefaultAction """ _validation = { @@ -594,6 +703,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2017_06_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2017_06_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2017_06_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2017_06_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -604,14 +728,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2017_06_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2017_06_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2017_06_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2017_06_01.models.ServiceSpecification """ _attribute_map = { @@ -630,6 +754,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2017_06_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2017_06_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -640,12 +774,12 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str """ _attribute_map = { @@ -662,6 +796,14 @@ def __init__( operation: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -671,8 +813,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2017_06_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2017_06_01.models.Operation] """ _attribute_map = { @@ -685,6 +827,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2017_06_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -700,11 +846,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] """ _validation = { @@ -728,6 +874,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -746,11 +899,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2017_06_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2017_06_01.models.ReasonCode """ _validation = { @@ -770,6 +923,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2017_06_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -781,50 +941,49 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: Required. The signed services accessible with the service SAS. Possible values + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: Required. The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -877,6 +1036,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: Required. The signed services accessible with the service SAS. Possible + values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", + "c", "f", "s". + :paramtype resource: str or ~azure.mgmt.storage.v2017_06_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2017_06_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2017_06_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -901,8 +1106,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2017_06_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2017_06_01.models.MetricSpecification] """ _attribute_map = { @@ -915,6 +1121,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2017_06_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -926,10 +1137,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the sku name. Required for account creation; optional for + :ivar name: Required. Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2017_06_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2017_06_01.models.SkuName :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2017_06_01.models.SkuTier @@ -944,9 +1155,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified sku, including file encryption, network acls, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2017_06_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2017_06_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2017_06_01.models.Restriction] """ _validation = { @@ -975,6 +1186,15 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the sku name. Required for account creation; optional for + update. Note that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.storage.v2017_06_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2017_06_01.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1011,6 +1231,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1027,17 +1249,17 @@ class StorageAccount(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2017_06_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "BlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_06_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2017_06_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2017_06_01.models.ProvisioningState @@ -1076,8 +1298,8 @@ class StorageAccount(Resource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet """ @@ -1137,6 +1359,18 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2017_06_01.models.Identity + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccount, self).__init__(location=location, tags=tags, **kwargs) self.sku = None self.kind = None @@ -1164,8 +1398,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -1189,6 +1423,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1198,37 +1436,37 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2017_06_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the sku name. + :vartype sku: ~azure.mgmt.storage.v2017_06_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "BlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_06_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2017_06_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :vartype encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool """ _validation = { @@ -1265,6 +1503,40 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the sku name. + :paramtype sku: ~azure.mgmt.storage.v2017_06_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2017_06_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2017_06_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -1308,6 +1580,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1336,6 +1610,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1361,6 +1637,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1370,9 +1648,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2. + :vartype key_name: str """ _validation = { @@ -1389,6 +1667,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -1396,30 +1679,30 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2017_06_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype sku: ~azure.mgmt.storage.v2017_06_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_06_01.models.Identity - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2017_06_01.models.Identity + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet + :vartype encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet """ _attribute_map = { @@ -1446,6 +1729,33 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. + :paramtype sku: ~azure.mgmt.storage.v2017_06_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2017_06_01.models.Identity + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2017_06_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2017_06_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2017_06_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2017_06_01.models.NetworkRuleSet + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -1478,6 +1788,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -1516,6 +1828,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -1526,8 +1840,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2017_06_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2017_06_01.models.Usage] """ _attribute_map = { @@ -1540,6 +1854,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2017_06_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -1569,6 +1887,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -1579,15 +1899,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2017_06_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2017_06_01.models.State """ _validation = { @@ -1608,6 +1928,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2017_06_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_storage_management_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_storage_management_enums.py index 126642341c46..f336ec50edb7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_storage_management_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_storage_management_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,28 +37,28 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -81,14 +66,14 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ STORAGE = "Storage" BLOB_STORAGE = "BlobStorage" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -102,7 +87,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -110,7 +95,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -118,7 +103,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -128,7 +113,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -138,7 +123,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -148,7 +133,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -158,7 +143,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -169,14 +154,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -186,7 +171,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py index c4e8c53feb58..2cb1c4499173 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2017_06_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py index 2878e851de87..9c7dc0062592 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + 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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py index ac8b8d149fcc..527d46eac815 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py @@ -5,25 +5,451 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_update_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + 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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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 + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +473,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2017_06_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_06_01.models.CheckNameAvailabilityResult @@ -69,30 +496,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +523,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +570,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +598,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2017_06_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +622,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +648,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +677,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,13 +700,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -327,27 +729,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,16 +753,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -399,32 +793,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,19 +822,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -458,34 +846,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,17 +886,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -521,8 +905,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -530,35 +916,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,18 +958,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -607,27 +990,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +1014,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -661,7 +1036,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2017_06_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountListKeysResult @@ -672,32 +1048,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,16 +1077,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -742,32 +1110,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,16 +1139,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -812,32 +1172,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -851,4 +1201,6 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py index b8e9bd93da75..37c9cce9481d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-06-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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 UsageOperations(object): """UsageOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py index 82424ef13154..b1e55270b061 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagement'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py index edf1c4ec007f..ab09db68dd7a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json index 3c75ea3f9f47..18c4818d73bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagement", "filename": "_storage_management", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementConfiguration\"]}}, \"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\": [\"StorageManagementConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py index ac56af646605..84edc883b649 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementConfiguration +from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from . import models - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -39,56 +34,60 @@ class StorageManagement(object): :vartype usage: azure.mgmt.storage.v2017_10_01.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py index 5bd005704dd7..95bb9e0d6b2c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management import StorageManagement __all__ = ['StorageManagement'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py index bc7317fc2de9..62905b5cff39 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementConfiguration, 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.") - super(StorageManagementConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py index b757fd32416f..6a82295fa58a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementConfiguration +from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .. import models - - -class StorageManagement(object): +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -32,59 +29,66 @@ class StorageManagement(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2017_10_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2017_10_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2017_10_01.aio.operations.StorageAccountsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.storage.v2017_10_01.aio.operations.UsageOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py index b4c1535f7db2..7564699777bd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py index da4d4780c46d..54a0cee61607 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py index f7436de7de95..34137157cf88 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2017_10_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_10_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2017_10_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2017_10_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -318,27 +305,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,8 +329,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -389,32 +369,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +398,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -438,8 +411,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -447,34 +422,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,11 +462,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -509,8 +481,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -518,35 +492,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -564,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -594,27 +566,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +590,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -647,7 +612,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2017_10_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountListKeysResult @@ -658,32 +624,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +653,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -727,32 +686,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccountSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -766,8 +715,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -796,32 +748,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,4 +777,6 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py index 7675582d3696..b0568aa54af2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2017_10_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py index c07ac99f870b..f43919086149 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py @@ -6,82 +6,44 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import KeyVaultProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import KeyVaultProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models.py deleted file mode 100644 index 247337f032db..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models.py +++ /dev/null @@ -1,1493 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2017_10_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2017_10_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2017_10_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2017_10_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2017_10_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, or table object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2017_10_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2017_10_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2017_10_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2017_10_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2017_10_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2017_10_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2017_10_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2017_10_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Resource(msrest.serialization.Model): - """Describes a storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2017_10_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: Required. The signed services accessible with the service SAS. Possible values - include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", - "s". - :type resource: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs['resource'] - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2017_10_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the sku name. Required for account creation; optional for - update. Note that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2017_10_01.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2017_10_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified sku, including file encryption, - network acls, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2017_10_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2017_10_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified sku, including file encryption, network acls, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified sku, including - file encryption, network acls, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class StorageAccount(Resource): - """The storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a - resource (across resource groups). - :type tags: dict[str, str] - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2017_10_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_10_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2017_10_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2017_10_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2017_10_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2017_10_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2017_10_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'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}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = None - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2017_10_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_10_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2017_10_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2017_10_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2017_10_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS - or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2017_10_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_10_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2017_10_01.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2017_10_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2017_10_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2017_10_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2017_10_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py index a7523b679d83..4e51bdf007ea 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py @@ -19,31 +19,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2017_10_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2017_10_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +77,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2017_10_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -121,6 +149,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -132,12 +162,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -156,6 +186,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -164,10 +202,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -182,6 +220,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -192,14 +236,14 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2017_10_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2017_10_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2017_10_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2017_10_01.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2017_10_01.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2017_10_01.models.KeyVaultProperties """ _validation = { @@ -220,6 +264,16 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2017_10_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2017_10_01.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2017_10_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -231,9 +285,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -255,6 +309,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -265,10 +324,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -294,6 +353,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2017_10_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -334,6 +399,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -374,6 +441,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -384,12 +453,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -408,6 +477,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -416,12 +493,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -438,6 +515,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -465,6 +550,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -490,6 +577,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -497,24 +586,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2017_10_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2017_10_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -543,6 +632,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2017_10_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -560,18 +669,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2017_10_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2017_10_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2017_10_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2017_10_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2017_10_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2017_10_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2017_10_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2017_10_01.models.DefaultAction """ _validation = { @@ -594,6 +703,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2017_10_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2017_10_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2017_10_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2017_10_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -604,14 +728,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2017_10_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2017_10_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2017_10_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2017_10_01.models.ServiceSpecification """ _attribute_map = { @@ -630,6 +754,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2017_10_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2017_10_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -640,12 +774,12 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str """ _attribute_map = { @@ -662,6 +796,14 @@ def __init__( operation: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -671,8 +813,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2017_10_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2017_10_01.models.Operation] """ _attribute_map = { @@ -685,6 +827,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2017_10_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -700,11 +846,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] """ _validation = { @@ -728,6 +874,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -746,11 +899,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2017_10_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2017_10_01.models.ReasonCode """ _validation = { @@ -770,6 +923,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2017_10_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -781,50 +941,49 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: Required. The signed services accessible with the service SAS. Possible values + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: Required. The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -877,6 +1036,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: Required. The signed services accessible with the service SAS. Possible + values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", + "c", "f", "s". + :paramtype resource: str or ~azure.mgmt.storage.v2017_10_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2017_10_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2017_10_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -901,8 +1106,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2017_10_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2017_10_01.models.MetricSpecification] """ _attribute_map = { @@ -915,6 +1121,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2017_10_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -926,10 +1137,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the sku name. Required for account creation; optional for + :ivar name: Required. Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2017_10_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2017_10_01.models.SkuName :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2017_10_01.models.SkuTier @@ -944,9 +1155,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified sku, including file encryption, network acls, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2017_10_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2017_10_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2017_10_01.models.Restriction] """ _validation = { @@ -975,6 +1186,15 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the sku name. Required for account creation; optional for + update. Note that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.storage.v2017_10_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2017_10_01.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1011,6 +1231,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1027,17 +1249,17 @@ class StorageAccount(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping a resource (across resource groups). - :type tags: dict[str, str] + :vartype tags: dict[str, str] :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2017_10_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_10_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2017_10_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2017_10_01.models.ProvisioningState @@ -1076,8 +1298,8 @@ class StorageAccount(Resource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet """ @@ -1137,6 +1359,18 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to a resource; can be used for viewing and grouping + a resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2017_10_01.models.Identity + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccount, self).__init__(location=location, tags=tags, **kwargs) self.sku = None self.kind = None @@ -1164,8 +1398,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -1189,6 +1423,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1198,37 +1436,37 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2017_10_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the sku name. + :vartype sku: ~azure.mgmt.storage.v2017_10_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_10_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2017_10_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :vartype encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool """ _validation = { @@ -1265,6 +1503,40 @@ def __init__( enable_https_traffic_only: Optional[bool] = False, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the sku name. + :paramtype sku: ~azure.mgmt.storage.v2017_10_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2017_10_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -1308,6 +1580,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1336,6 +1610,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1361,6 +1637,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1370,9 +1648,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2. + :vartype key_name: str """ _validation = { @@ -1389,6 +1667,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -1396,33 +1679,33 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2017_10_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype sku: ~azure.mgmt.storage.v2017_10_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2017_10_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2017_10_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet + :vartype encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet """ _attribute_map = { @@ -1451,6 +1734,36 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. + :paramtype sku: ~azure.mgmt.storage.v2017_10_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2017_10_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2017_10_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2017_10_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2017_10_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2017_10_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2017_10_01.models.NetworkRuleSet + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -1484,6 +1797,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -1522,6 +1837,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -1532,8 +1849,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2017_10_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2017_10_01.models.Usage] """ _attribute_map = { @@ -1546,6 +1863,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2017_10_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -1575,6 +1896,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -1585,15 +1908,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2017_10_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2017_10_01.models.State """ _validation = { @@ -1614,6 +1937,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2017_10_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_storage_management_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_storage_management_enums.py index 83fdca35bb84..d02bb1744c31 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_storage_management_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_storage_management_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,28 +37,28 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -81,7 +66,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -89,7 +74,7 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STORAGE_V2 = "StorageV2" BLOB_STORAGE = "BlobStorage" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -103,7 +88,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -111,7 +96,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -119,7 +104,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -129,7 +114,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -139,7 +124,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -149,7 +134,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -159,7 +144,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -170,14 +155,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -187,7 +172,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py index dd286793eb48..483aa53603fa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2017_10_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py index 26d4f4ee9843..6e35ddde351f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + 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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py index 62a52a1945c5..2e8307ae2c8c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py @@ -5,25 +5,451 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_update_request( + resource_group_name: str, + account_name: str, + 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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + 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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "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 + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +473,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2017_10_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_10_01.models.CheckNameAvailabilityResult @@ -69,30 +496,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +523,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +570,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +598,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2017_10_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +622,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +648,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +677,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,13 +700,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -327,27 +729,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,16 +753,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -399,32 +793,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,19 +822,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -458,34 +846,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,17 +886,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -521,8 +905,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2017_10_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -530,35 +916,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,18 +958,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -607,27 +990,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +1014,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -661,7 +1036,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2017_10_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountListKeysResult @@ -672,32 +1048,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,16 +1077,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -742,32 +1110,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,16 +1139,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -812,32 +1172,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json, text/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -851,4 +1201,6 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py index e332398eda31..1713537c89a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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 UsageOperations(object): """UsageOperations operations. @@ -45,11 +78,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +95,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json, text/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +135,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py index 18b98ce504fa..000f8a8fa02a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json index a2c24b4895f4..139aa781ea20 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py index 068f4c223601..cad72c4b41d8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, Operations, SkusOperations, StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .operations import BlobContainersOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -44,56 +38,58 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py index 2b4668fe1549..4753ba582e4f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py index 5212691cddec..362dd69b698c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, Operations, SkusOperations, StorageAccountsOperations, UsageOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsageOperations -from .operations import BlobContainersOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -33,63 +29,69 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2018_02_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2018_02_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2018_02_01.aio.operations.StorageAccountsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.storage.v2018_02_01.aio.operations.UsageOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2018_02_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2018_02_01.aio.operations.BlobContainersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usage = UsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py index 0745b0e44630..f48caaa52136 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -66,27 +71,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -138,33 +136,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +166,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -215,33 +206,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,8 +236,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -288,28 +272,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,8 +297,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -356,26 +333,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,6 +357,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -424,33 +395,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -464,8 +425,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -501,33 +465,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,8 +495,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -584,40 +541,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -627,14 +571,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -672,32 +620,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -707,14 +642,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -754,31 +693,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -788,14 +715,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -833,29 +764,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,14 +786,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -915,37 +840,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -955,14 +870,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -998,36 +917,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1041,4 +950,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py index afacadb61fae..14ccad1fdee1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py index a8133bca91dd..449ca6e2634c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py index 0842a3a0d05c..fac93bbe74ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_02_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_02_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_02_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_02_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -318,27 +305,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,8 +329,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -389,32 +369,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +398,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -438,8 +411,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -447,34 +422,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,11 +462,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -509,8 +481,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -518,35 +492,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -564,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -594,27 +566,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +590,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -647,7 +612,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_02_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountListKeysResult @@ -658,32 +624,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +653,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -727,32 +686,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccountSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -766,8 +715,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -796,32 +748,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,4 +777,6 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py index d04e257ee6de..525d91eb16e8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usage_operations import build_list_by_location_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,11 +104,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages'} # type: ignore + @distributed_trace def list_by_location( self, location: str, @@ -119,7 +123,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_02_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -127,35 +132,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -173,6 +174,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py index 4dc88aa02203..7968a3f4625f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py @@ -6,108 +6,57 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import AzureEntityResource - from ._models_py3 import BlobContainer - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import AzureEntityResource +from ._models_py3 import BlobContainer +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models.py deleted file mode 100644 index 8876aeaf9988..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models.py +++ /dev/null @@ -1,2133 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_02_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_02_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2018_02_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_02_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_02_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_02_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the - blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'required': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs['immutability_period_since_creation_in_days'] - self.state = None - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2018_02_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_02_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_02_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """The list of blob containers. - - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_02_01.models.ListContainerItem] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_02_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_02_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2018_02_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_02_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_02_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_02_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2018_02_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_02_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_02_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2018_02_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the sku name. Required for account creation; optional for - update. Note that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2018_02_01.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2018_02_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified sku, including file encryption, - network acls, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2018_02_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_02_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified sku, including file encryption, network acls, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified sku, including - file encryption, network acls, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2018_02_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_02_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2018_02_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2018_02_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2018_02_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2018_02_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2018_02_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', False) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2018_02_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_02_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.is_hns_enabled = kwargs.get('is_hns_enabled', False) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2018_02_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2018_02_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_02_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS - or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2018_02_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_02_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_02_01.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2018_02_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2018_02_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_02_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_02_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py index 479bf8bb2d31..4504b6849448 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py @@ -19,31 +19,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_02_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2018_02_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +77,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2018_02_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -119,6 +147,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -160,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -179,9 +211,9 @@ class BlobContainer(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -193,8 +225,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyProperties @@ -250,6 +282,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -296,6 +335,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -307,12 +348,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -331,6 +372,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -339,10 +388,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -357,6 +406,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -367,14 +422,14 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_02_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2018_02_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_02_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_02_01.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2018_02_01.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2018_02_01.models.KeyVaultProperties """ _validation = { @@ -395,6 +450,16 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2018_02_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2018_02_01.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2018_02_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -406,9 +471,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -430,6 +495,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -440,10 +510,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -469,6 +539,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2018_02_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -517,6 +593,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -559,6 +637,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -581,9 +661,9 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the + :ivar immutability_period_since_creation_in_days: Required. The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyState @@ -613,6 +693,11 @@ def __init__( immutability_period_since_creation_in_days: int, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: Required. The immutability period for the + blobs in the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -627,9 +712,9 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2018_02_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyState @@ -654,6 +739,11 @@ def __init__( immutability_period_since_creation_in_days: Optional[int] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -666,12 +756,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -690,6 +780,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -698,12 +796,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -720,6 +818,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -731,20 +837,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -769,6 +875,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -780,11 +902,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -799,6 +921,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -816,9 +945,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -837,6 +966,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -852,8 +986,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_02_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2018_02_01.models.TagProperty] """ _validation = { @@ -871,6 +1005,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2018_02_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -897,6 +1035,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -916,9 +1056,9 @@ class ListContainerItem(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -930,8 +1070,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicyProperties @@ -987,6 +1127,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_02_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -1003,8 +1150,8 @@ def __init__( class ListContainerItems(msrest.serialization.Model): """The list of blob containers. - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_02_01.models.ListContainerItem] + :ivar value: The list of blob containers. + :vartype value: list[~azure.mgmt.storage.v2018_02_01.models.ListContainerItem] """ _attribute_map = { @@ -1017,6 +1164,10 @@ def __init__( value: Optional[List["ListContainerItem"]] = None, **kwargs ): + """ + :keyword value: The list of blob containers. + :paramtype value: list[~azure.mgmt.storage.v2018_02_01.models.ListContainerItem] + """ super(ListContainerItems, self).__init__(**kwargs) self.value = value @@ -1042,6 +1193,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1049,24 +1202,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_02_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2018_02_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -1095,6 +1248,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2018_02_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1112,18 +1285,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_02_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2018_02_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_02_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2018_02_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2018_02_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2018_02_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_02_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2018_02_01.models.DefaultAction """ _validation = { @@ -1146,6 +1319,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2018_02_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2018_02_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2018_02_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2018_02_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -1156,14 +1344,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_02_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2018_02_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2018_02_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2018_02_01.models.ServiceSpecification """ _attribute_map = { @@ -1182,6 +1370,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2018_02_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2018_02_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1192,14 +1390,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -1218,6 +1416,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1228,8 +1436,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_02_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2018_02_01.models.Operation] """ _attribute_map = { @@ -1242,6 +1450,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2018_02_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -1256,11 +1468,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_02_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2018_02_01.models.ReasonCode """ _validation = { @@ -1280,6 +1492,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2018_02_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -1291,49 +1510,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -1385,6 +1603,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2018_02_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_02_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_02_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -1409,8 +1673,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2018_02_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2018_02_01.models.MetricSpecification] """ _attribute_map = { @@ -1423,6 +1688,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2018_02_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -1434,10 +1704,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the sku name. Required for account creation; optional for + :ivar name: Required. Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2018_02_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2018_02_01.models.SkuName :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2018_02_01.models.SkuTier @@ -1452,9 +1722,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified sku, including file encryption, network acls, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2018_02_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_02_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2018_02_01.models.Restriction] """ _validation = { @@ -1483,6 +1753,15 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the sku name. Required for account creation; optional for + update. Note that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.storage.v2018_02_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2018_02_01.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1519,6 +1798,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1539,10 +1820,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -1567,6 +1848,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1587,16 +1874,16 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2018_02_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_02_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_02_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2018_02_01.models.ProvisioningState @@ -1635,12 +1922,12 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool """ _validation = { @@ -1701,6 +1988,19 @@ def __init__( is_hns_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_02_01.models.Identity + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -1729,8 +2029,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -1754,6 +2054,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1763,39 +2067,39 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2018_02_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the sku name. + :vartype sku: ~azure.mgmt.storage.v2018_02_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_02_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_02_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :vartype encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool """ _validation = { @@ -1834,6 +2138,42 @@ def __init__( is_hns_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the sku name. + :paramtype sku: ~azure.mgmt.storage.v2018_02_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_02_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -1878,6 +2218,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1906,6 +2248,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1931,6 +2275,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1940,9 +2286,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2. + :vartype key_name: str """ _validation = { @@ -1959,6 +2305,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -1966,33 +2317,33 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2018_02_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype sku: ~azure.mgmt.storage.v2018_02_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_02_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_02_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet + :vartype encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet """ _attribute_map = { @@ -2021,6 +2372,36 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. + :paramtype sku: ~azure.mgmt.storage.v2018_02_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_02_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_02_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_02_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_02_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_02_01.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_02_01.models.NetworkRuleSet + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -2054,6 +2435,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2095,6 +2478,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2147,6 +2532,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2190,6 +2577,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2200,8 +2589,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_02_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2018_02_01.models.Usage] """ _attribute_map = { @@ -2214,6 +2603,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2018_02_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -2243,6 +2636,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2253,15 +2648,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_02_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2018_02_01.models.State """ _validation = { @@ -2282,6 +2677,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2018_02_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py index 2909ae5a6bed..88318ccb431b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,28 +37,28 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -82,14 +67,14 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -97,7 +82,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -105,7 +90,7 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STORAGE_V2 = "StorageV2" BLOB_STORAGE = "BlobStorage" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -115,7 +100,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -123,7 +108,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -133,14 +118,14 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -154,7 +139,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -162,7 +147,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -170,7 +155,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -178,7 +163,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -188,7 +173,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -198,7 +183,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -208,7 +193,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -218,7 +203,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -229,14 +214,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -246,7 +231,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py index 30be846f0a80..10cc583ad191 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py @@ -5,22 +5,582 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,13 +604,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListContainerItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListContainerItems": """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -71,27 +631,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,17 +655,19 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -144,33 +696,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,17 +726,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -222,33 +766,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,16 +796,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -296,28 +832,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,16 +857,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -365,26 +893,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -397,15 +917,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -434,33 +955,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -474,17 +985,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -512,33 +1025,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,18 +1055,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -596,40 +1101,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -639,23 +1131,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -685,32 +1180,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -720,23 +1202,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the @@ -768,31 +1253,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -802,23 +1275,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -848,29 +1324,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -880,24 +1346,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -931,37 +1400,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -971,23 +1430,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1015,36 +1477,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1058,4 +1510,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py index f35f77e881ea..696cc6a3b2e7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2018_02_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py index effa8fb43cc9..5f82f0c4a2c0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py index 8607e3345db0..41dde583407a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py @@ -5,25 +5,451 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +473,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_02_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_02_01.models.CheckNameAvailabilityResult @@ -69,30 +496,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +523,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +570,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +598,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2018_02_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +622,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +648,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +677,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,13 +700,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -327,27 +729,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,16 +753,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -399,32 +793,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,19 +822,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -458,34 +846,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,17 +886,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -521,8 +905,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -530,35 +916,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,18 +958,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -607,27 +990,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +1014,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -661,7 +1036,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_02_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountListKeysResult @@ -672,32 +1048,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,16 +1077,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -742,32 +1110,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,16 +1139,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -812,32 +1172,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -851,4 +1201,6 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py index fad16b17f7c2..f36aaff8fb66 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py @@ -5,23 +5,89 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsageOperations(object): """UsageOperations operations. @@ -45,11 +111,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +128,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +168,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages'} # type: ignore + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -133,35 +195,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -179,6 +237,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py index 34de4aa03017..258189627fdb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json index f43ef6f0e135..57bd56d7a830 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py index cfc02e2a148a..23c2bf1f1b23 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import BlobContainersOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -35,65 +29,69 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2018_03_01_preview.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2018_03_01_preview.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2018_03_01_preview.operations.StorageAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2018_03_01_preview.operations.UsagesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2018_03_01_preview.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2018_03_01_preview.operations.BlobContainersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py index c63a8a0b88b0..edeb9aee8f38 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py index 9e79123232e8..ba2dcab1ef40 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import BlobContainersOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -33,63 +29,69 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2018_03_01_preview.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2018_03_01_preview.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2018_03_01_preview.aio.operations.StorageAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2018_03_01_preview.aio.operations.UsagesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2018_03_01_preview.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2018_03_01_preview.aio.operations.BlobContainersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py index cbbc78a23b4d..38ff461e4a91 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -66,27 +71,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -138,33 +136,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +166,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -215,33 +206,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,8 +236,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -288,28 +272,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,8 +297,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -356,26 +333,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,6 +357,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -424,33 +395,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -464,8 +425,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -501,33 +465,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,8 +495,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -584,40 +541,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -627,14 +571,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -672,32 +620,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -707,14 +642,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -754,31 +693,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -788,14 +715,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -833,29 +764,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,14 +786,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -915,37 +840,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -955,14 +870,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -998,36 +917,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1041,4 +950,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py index f16fcc74108e..5f78fa9d0ca5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py index 78e9436d07d3..aaa32108fdd7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py index 798a72a41dd5..c80f2ac5904a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_or_update_management_policies_request, build_create_request_initial, build_delete_management_policies_request, build_delete_request, build_get_management_policies_request, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -318,27 +305,17 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,8 +329,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -389,32 +369,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +398,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -438,8 +411,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -447,34 +422,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,11 +462,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -509,8 +481,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -518,35 +492,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -564,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -594,27 +566,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +590,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -647,7 +612,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListKeysResult @@ -658,32 +624,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +653,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -727,32 +686,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -766,8 +715,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -796,32 +748,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,8 +777,11 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + + @distributed_trace_async async def get_management_policies( self, resource_group_name: str, @@ -855,7 +800,8 @@ async def get_management_policies( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountManagementPolicies, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies @@ -866,28 +812,18 @@ async def get_management_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_management_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_management_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get_management_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -901,8 +837,11 @@ async def get_management_policies( return cls(pipeline_response, deserialized, {}) return deserialized + get_management_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update_management_policies( self, resource_group_name: str, @@ -922,9 +861,11 @@ async def create_or_update_management_policies( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName :param properties: The data policy rules to set to a storage account. - :type properties: ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPoliciesRulesSetParameter + :type properties: + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPoliciesRulesSetParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountManagementPolicies, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies @@ -935,33 +876,23 @@ async def create_or_update_management_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_management_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_management_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update_management_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -975,8 +906,11 @@ async def create_or_update_management_policies( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_management_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_management_policies( self, resource_group_name: str, @@ -995,7 +929,8 @@ async def delete_management_policies( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName :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 @@ -1006,26 +941,18 @@ async def delete_management_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete_management_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_management_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete_management_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1037,3 +964,4 @@ async def delete_management_policies( return cls(pipeline_response, None, {}) delete_management_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py index af7951014e4d..dfecb552b881 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,11 +104,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages'} # type: ignore + @distributed_trace def list_by_location( self, location: str, @@ -119,7 +123,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -127,35 +132,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -173,6 +174,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py index bd1ce31b087b..502feb60e149 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py @@ -6,116 +6,61 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import AzureEntityResource - from ._models_py3 import BlobContainer - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CustomDomain - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ManagementPoliciesRules - from ._models_py3 import ManagementPoliciesRulesSetParameter - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountManagementPolicies - from ._models_py3 import StorageAccountManagementPoliciesRulesProperty - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ManagementPoliciesRules # type: ignore - from ._models import ManagementPoliciesRulesSetParameter # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountManagementPolicies # type: ignore - from ._models import StorageAccountManagementPoliciesRulesProperty # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import AzureEntityResource +from ._models_py3 import BlobContainer +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CustomDomain +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ManagementPoliciesRules +from ._models_py3 import ManagementPoliciesRulesSetParameter +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountManagementPolicies +from ._models_py3 import StorageAccountManagementPoliciesRulesProperty +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models.py deleted file mode 100644 index 3317718d039c..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models.py +++ /dev/null @@ -1,2253 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_03_01_preview.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_03_01_preview.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_03_01_preview.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the - blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'required': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs['immutability_period_since_creation_in_days'] - self.state = None - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: - list[~azure.mgmt.storage.v2018_03_01_preview.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyState - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_03_01_preview.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_03_01_preview.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """The list of blob containers. - - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_03_01_preview.models.ListContainerItem] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ManagementPoliciesRules(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - """ - - _attribute_map = { - 'policy': {'key': 'policy', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPoliciesRules, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - - -class ManagementPoliciesRulesSetParameter(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - """ - - _attribute_map = { - 'policy': {'key': 'properties.policy', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPoliciesRulesSetParameter, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.storage.v2018_03_01_preview.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_03_01_preview.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_03_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: - ~azure.mgmt.storage.v2018_03_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: - list[~azure.mgmt.storage.v2018_03_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the sku name. Required for account creation; optional for - update. Note that in older versions, sku name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified sku, including file encryption, - network acls, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2018_03_01_preview.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified sku, including file encryption, network acls, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified sku, including - file encryption, network acls, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2018_03_01_preview.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2018_03_01_preview.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or - ~azure.mgmt.storage.v2018_03_01_preview.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2018_03_01_preview.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', False) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.is_hns_enabled = kwargs.get('is_hns_enabled', False) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountManagementPolicies(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy': {'key': 'properties.policy', 'type': 'object'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountManagementPolicies, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - self.last_modified_time = None - - -class StorageAccountManagementPoliciesRulesProperty(ManagementPoliciesRules): - """The Storage Account Data Policies properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - """ - - _validation = { - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'policy': {'key': 'policy', 'type': 'object'}, - 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountManagementPoliciesRulesProperty, self).__init__(**kwargs) - self.last_modified_time = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS - or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or - ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2018_03_01_preview.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2018_03_01_preview.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py index d0bed1a06631..1617b93056d4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py @@ -19,31 +19,32 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +78,35 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -119,6 +149,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -160,6 +192,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -179,9 +213,9 @@ class BlobContainer(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -193,8 +227,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyProperties @@ -250,6 +284,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -296,6 +337,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -307,12 +350,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -331,6 +374,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -339,10 +390,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -357,6 +408,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -367,14 +424,15 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_03_01_preview.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_03_01_preview.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2018_03_01_preview.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: + ~azure.mgmt.storage.v2018_03_01_preview.models.KeyVaultProperties """ _validation = { @@ -395,6 +453,17 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2018_03_01_preview.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2018_03_01_preview.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -406,9 +475,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -430,6 +499,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -440,10 +514,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -469,6 +543,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2018_03_01_preview.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -517,6 +597,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -559,6 +641,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -581,9 +665,9 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the + :ivar immutability_period_since_creation_in_days: Required. The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyState @@ -613,6 +697,11 @@ def __init__( immutability_period_since_creation_in_days: int, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: Required. The immutability period for the + blobs in the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -628,9 +717,9 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2018_03_01_preview.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyState @@ -655,6 +744,11 @@ def __init__( immutability_period_since_creation_in_days: Optional[int] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -667,12 +761,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -691,6 +785,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -699,12 +801,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -721,6 +823,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -732,20 +842,21 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -770,6 +881,23 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -781,11 +909,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -800,6 +928,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -817,9 +952,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -838,6 +973,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -853,8 +993,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_03_01_preview.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2018_03_01_preview.models.TagProperty] """ _validation = { @@ -872,6 +1012,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2018_03_01_preview.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -898,6 +1042,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -917,9 +1063,9 @@ class ListContainerItem(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -931,8 +1077,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicyProperties @@ -988,6 +1134,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_03_01_preview.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -1004,8 +1157,8 @@ def __init__( class ListContainerItems(msrest.serialization.Model): """The list of blob containers. - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_03_01_preview.models.ListContainerItem] + :ivar value: The list of blob containers. + :vartype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.ListContainerItem] """ _attribute_map = { @@ -1018,6 +1171,10 @@ def __init__( value: Optional[List["ListContainerItem"]] = None, **kwargs ): + """ + :keyword value: The list of blob containers. + :paramtype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.ListContainerItem] + """ super(ListContainerItems, self).__init__(**kwargs) self.value = value @@ -1043,6 +1200,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1050,9 +1209,9 @@ def __init__( class ManagementPoliciesRules(msrest.serialization.Model): """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any """ _attribute_map = { @@ -1065,6 +1224,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(ManagementPoliciesRules, self).__init__(**kwargs) self.policy = policy @@ -1072,9 +1236,9 @@ def __init__( class ManagementPoliciesRulesSetParameter(msrest.serialization.Model): """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any """ _attribute_map = { @@ -1087,6 +1251,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(ManagementPoliciesRulesSetParameter, self).__init__(**kwargs) self.policy = policy @@ -1094,24 +1263,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -1140,6 +1309,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1157,19 +1346,19 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2018_03_01_preview.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_03_01_preview.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2018_03_01_preview.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.DefaultAction """ _validation = { @@ -1192,6 +1381,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2018_03_01_preview.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2018_03_01_preview.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -1202,14 +1406,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_03_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2018_03_01_preview.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2018_03_01_preview.models.ServiceSpecification """ @@ -1229,6 +1433,17 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2018_03_01_preview.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: + ~azure.mgmt.storage.v2018_03_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1239,14 +1454,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -1265,6 +1480,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1275,8 +1500,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Operation] """ _attribute_map = { @@ -1289,6 +1514,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -1303,11 +1532,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ReasonCode """ _validation = { @@ -1327,6 +1556,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -1338,49 +1574,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -1432,6 +1667,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_03_01_preview.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -1456,8 +1737,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.storage.v2018_03_01_preview.models.MetricSpecification] """ @@ -1471,6 +1752,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2018_03_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -1482,10 +1768,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the sku name. Required for account creation; optional for + :ivar name: Required. Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". - :type name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SkuName :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SkuTier @@ -1500,9 +1786,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified sku, including file encryption, network acls, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2018_03_01_preview.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Restriction] """ _validation = { @@ -1531,6 +1817,15 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the sku name. Required for account creation; optional for + update. Note that in older versions, sku name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS". + :paramtype name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2018_03_01_preview.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1567,6 +1862,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1587,10 +1884,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -1615,6 +1912,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1635,16 +1938,16 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or @@ -1685,12 +1988,12 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool """ _validation = { @@ -1751,6 +2054,19 @@ def __init__( is_hns_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -1779,8 +2095,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -1804,6 +2120,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1813,39 +2133,39 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the sku name. - :type sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the sku name. + :vartype sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :vartype encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool """ _validation = { @@ -1884,6 +2204,42 @@ def __init__( is_hns_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the sku name. + :paramtype sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -1928,6 +2284,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1956,6 +2314,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1981,6 +2341,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1998,9 +2360,9 @@ class StorageAccountManagementPolicies(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime """ @@ -2026,6 +2388,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(StorageAccountManagementPolicies, self).__init__(**kwargs) self.policy = policy self.last_modified_time = None @@ -2036,9 +2403,9 @@ class StorageAccountManagementPoliciesRulesProperty(ManagementPoliciesRules): Variables are only populated by the server, and will be ignored when sending a request. - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime """ @@ -2058,6 +2425,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(StorageAccountManagementPoliciesRulesProperty, self).__init__(policy=policy, **kwargs) self.last_modified_time = None @@ -2067,9 +2439,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2. + :vartype key_name: str """ _validation = { @@ -2086,6 +2458,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -2093,33 +2470,33 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. - :type sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet + :vartype encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet """ _attribute_map = { @@ -2148,6 +2525,36 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value. + :paramtype sku: ~azure.mgmt.storage.v2018_03_01_preview.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_03_01_preview.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_03_01_preview.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_03_01_preview.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_03_01_preview.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_03_01_preview.models.AccessTier + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_03_01_preview.models.NetworkRuleSet + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -2181,6 +2588,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2222,6 +2631,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2275,6 +2686,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2318,6 +2731,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2328,8 +2743,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Usage] """ _attribute_map = { @@ -2342,6 +2757,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2018_03_01_preview.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -2371,6 +2790,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2381,15 +2802,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.State + :vartype state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.State """ _validation = { @@ -2410,6 +2831,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2018_03_01_preview.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py index 12b17087101a..3b47b1533b08 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,28 +37,28 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -82,14 +67,14 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -97,7 +82,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -105,7 +90,7 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STORAGE_V2 = "StorageV2" BLOB_STORAGE = "BlobStorage" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -115,7 +100,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -123,7 +108,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -133,18 +118,18 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -158,7 +143,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -166,7 +151,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -174,7 +159,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -182,7 +167,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -192,7 +177,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -202,7 +187,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -212,7 +197,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -222,7 +207,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. """ @@ -233,14 +218,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -250,7 +235,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py index c2b617cc213d..fdc8274544c3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py @@ -5,22 +5,582 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,13 +604,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListContainerItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListContainerItems": """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -71,27 +631,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,17 +655,19 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -144,33 +696,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,17 +726,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -222,33 +766,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,16 +796,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -296,28 +832,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,16 +857,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -365,26 +893,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -397,15 +917,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -434,33 +955,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -474,17 +985,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -512,33 +1025,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,18 +1055,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -596,40 +1101,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -639,23 +1131,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -685,32 +1180,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -720,23 +1202,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the @@ -768,31 +1253,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -802,23 +1275,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -848,29 +1324,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -880,24 +1346,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -931,37 +1400,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -971,23 +1430,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1015,36 +1477,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1058,4 +1510,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py index 6d68c52723b4..06262a2db446 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2018_03_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py index fd75156fc7f6..b765bcd1572e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py index 37821a6431a6..92b04b26792c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py @@ -5,25 +5,565 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_management_policies_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_management_policies_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_management_policies_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +587,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.CheckNameAvailabilityResult @@ -69,30 +610,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +637,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +684,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +712,20 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +737,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +763,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +792,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,13 +815,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -327,27 +844,17 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,16 +868,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -399,32 +908,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,19 +937,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -458,34 +961,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,17 +1001,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -521,8 +1020,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -530,35 +1031,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,18 +1073,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -607,27 +1105,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +1129,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -661,7 +1151,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListKeysResult @@ -672,32 +1163,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,16 +1192,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -742,32 +1225,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -781,16 +1254,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -812,32 +1287,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -851,16 +1316,18 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + + @distributed_trace def get_management_policies( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountManagementPolicies" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.StorageAccountManagementPolicies": """Gets the data policy rules associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -872,7 +1339,8 @@ def get_management_policies( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountManagementPolicies, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies @@ -883,28 +1351,18 @@ def get_management_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_management_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_management_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get_management_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -918,17 +1376,19 @@ def get_management_policies( return cls(pipeline_response, deserialized, {}) return deserialized + get_management_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update_management_policies( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPoliciesRulesSetParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountManagementPolicies" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPoliciesRulesSetParameter", + **kwargs: Any + ) -> "_models.StorageAccountManagementPolicies": """Sets the data policy rules associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -940,9 +1400,11 @@ def create_or_update_management_policies( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName :param properties: The data policy rules to set to a storage account. - :type properties: ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPoliciesRulesSetParameter + :type properties: + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPoliciesRulesSetParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountManagementPolicies, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies @@ -953,33 +1415,23 @@ def create_or_update_management_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_management_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_management_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update_management_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -993,16 +1445,18 @@ def create_or_update_management_policies( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_management_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete_management_policies( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the data policy rules associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1014,7 +1468,8 @@ def delete_management_policies( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_03_01_preview.models.ManagementPolicyName :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 @@ -1025,26 +1480,18 @@ def delete_management_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete_management_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_management_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete_management_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1056,3 +1503,4 @@ def delete_management_policies( return cls(pipeline_response, None, {}) delete_management_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py index e2cfb72fccde..95f9762d1a61 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py @@ -5,23 +5,89 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,16 +111,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -62,34 +129,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +169,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages'} # type: ignore + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -125,7 +188,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_03_01_preview.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -133,35 +197,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -179,6 +239,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py index f3d8366b8277..027df7375e6c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json index a1c7fee4efe7..7f3524dbdbe5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py index becb08726f0d..a177d6653d3c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobServicesOperations, ManagementPoliciesOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import ManagementPoliciesOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -45,65 +37,66 @@ class StorageManagementClient(object): :ivar blob_containers: BlobContainersOperations operations :vartype blob_containers: azure.mgmt.storage.v2018_07_01.operations.BlobContainersOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2018_07_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2018_07_01.operations.ManagementPoliciesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py index 60a2a379f112..fe4c525e94d1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +63,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py index 5f5960a05e5f..b76300387370 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobServicesOperations, ManagementPoliciesOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import ManagementPoliciesOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -35,71 +29,76 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2018_07_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2018_07_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2018_07_01.aio.operations.StorageAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2018_07_01.aio.operations.UsagesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2018_07_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2018_07_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2018_07_01.aio.operations.BlobContainersOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2018_07_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2018_07_01.aio.operations.ManagementPoliciesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py index fa446262595e..aa84be944156 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -66,27 +71,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -138,33 +136,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +166,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -215,33 +206,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,8 +236,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -288,28 +272,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,8 +297,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -356,26 +333,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,6 +357,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -424,33 +395,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -464,8 +425,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -501,33 +465,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,8 +495,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -584,40 +541,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -627,14 +571,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -672,32 +620,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -707,14 +642,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -754,31 +693,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -788,14 +715,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -833,29 +764,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,14 +786,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -915,37 +840,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -955,14 +870,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -998,36 +917,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1041,4 +950,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py index fc13dc5fd68d..bb77d1ea4a29 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -70,34 +75,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,8 +104,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -139,29 +135,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,4 +159,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_management_policies_operations.py index 57e4c676eebc..8199f2dd6d7a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountManagementPolicies, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountManagementPolicies @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName :param properties: The data policy rules to set to a storage account. :type properties: ~azure.mgmt.storage.v2018_07_01.models.ManagementPoliciesRulesSetParameter :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py index 8f374fe94387..32cf2b704583 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py index a79667a98862..61360cf1c6dc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py index 4ec8dc6ea00f..3895931d3a31 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_07_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_07_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_07_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_07_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -311,6 +298,7 @@ async def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. + The default value is "geoReplicationStats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccount, or the result of cls(response) @@ -322,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -395,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -444,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -453,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -498,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -515,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -524,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -600,27 +572,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -634,8 +596,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -653,7 +618,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_07_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountListKeysResult @@ -664,32 +630,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -703,8 +659,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -733,32 +692,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -772,8 +721,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -802,32 +754,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -841,8 +783,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -854,25 +798,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -885,6 +821,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -904,15 +842,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -926,21 +866,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -952,4 +885,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py index b6dc43fd9328..08c9560de9ad 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_07_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py index 97ff44bf38f7..8b38101cbc31 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py @@ -6,126 +6,66 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import AzureEntityResource - from ._models_py3 import BlobContainer - from ._models_py3 import BlobServiceProperties - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ManagementPoliciesRules - from ._models_py3 import ManagementPoliciesRulesSetParameter - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountManagementPolicies - from ._models_py3 import StorageAccountManagementPoliciesRulesProperty - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ManagementPoliciesRules # type: ignore - from ._models import ManagementPoliciesRulesSetParameter # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountManagementPolicies # type: ignore - from ._models import StorageAccountManagementPoliciesRulesProperty # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import AzureEntityResource +from ._models_py3 import BlobContainer +from ._models_py3 import BlobServiceProperties +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ManagementPoliciesRules +from ._models_py3 import ManagementPoliciesRulesSetParameter +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountManagementPolicies +from ._models_py3 import StorageAccountManagementPoliciesRulesProperty +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models.py deleted file mode 100644 index ea1e6fc66306..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models.py +++ /dev/null @@ -1,2468 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_07_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_07_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2018_07_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2018_07_01.models.DeleteRetentionPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2018_07_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2018_07_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2018_07_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The blob service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. - :type enabled: bool - :param days: Indicates the number of days that the deleted blob should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_07_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_07_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_07_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the - blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'required': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs['immutability_period_since_creation_in_days'] - self.state = None - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2018_07_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_07_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_07_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """The list of blob containers. - - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_07_01.models.ListContainerItem] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ManagementPoliciesRules(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - """ - - _attribute_map = { - 'policy': {'key': 'policy', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPoliciesRules, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - - -class ManagementPoliciesRulesSetParameter(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - """ - - _attribute_map = { - 'policy': {'key': 'properties.policy', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPoliciesRulesSetParameter, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_07_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_07_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2018_07_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_07_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_07_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_07_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2018_07_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_07_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_07_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2018_07_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the SKU name. Required for account creation; optional for - update. Note that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS". - :type name: str or ~azure.mgmt.storage.v2018_07_01.models.SkuName - :ivar tier: Gets the SKU tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2018_07_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2018_07_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_07_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2018_07_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_07_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2018_07_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2018_07_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2018_07_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2018_07_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2018_07_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets - to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_azure_files_aad_integration': {'key': 'properties.azureFilesAadIntegration', 'type': 'bool'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_azure_files_aad_integration = kwargs.get('enable_azure_files_aad_integration', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2018_07_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_07_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets - to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_azure_files_aad_integration': {'key': 'properties.azureFilesAadIntegration', 'type': 'bool'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_azure_files_aad_integration = kwargs.get('enable_azure_files_aad_integration', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2018_07_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2018_07_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_07_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountManagementPolicies(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy': {'key': 'properties.policy', 'type': 'object'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountManagementPolicies, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - self.last_modified_time = None - - -class StorageAccountManagementPoliciesRulesProperty(ManagementPoliciesRules): - """The Storage Account Data Policies properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details - in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - """ - - _validation = { - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'policy': {'key': 'policy', 'type': 'object'}, - 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountManagementPoliciesRulesProperty, self).__init__(**kwargs) - self.last_modified_time = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2018_07_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_07_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets - to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_azure_files_aad_integration': {'key': 'properties.azureFilesAadIntegration', 'type': 'bool'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_azure_files_aad_integration = kwargs.get('enable_azure_files_aad_integration', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_07_01.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2018_07_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2018_07_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_07_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_07_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py index 6131ef6b9580..faa5d60322eb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py @@ -19,31 +19,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_07_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2018_07_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +77,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2018_07_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -119,6 +147,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -160,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -179,9 +211,9 @@ class BlobContainer(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -193,8 +225,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyProperties @@ -250,6 +282,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -276,16 +315,16 @@ class BlobServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2018_07_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2018_07_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2018_07_01.models.DeleteRetentionPolicy + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2018_07_01.models.DeleteRetentionPolicy """ _validation = { @@ -311,6 +350,19 @@ def __init__( delete_retention_policy: Optional["DeleteRetentionPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2018_07_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2018_07_01.models.DeleteRetentionPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.cors = cors self.default_service_version = default_service_version @@ -350,6 +402,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -361,22 +415,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2018_07_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -405,6 +459,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2018_07_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -416,9 +488,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2018_07_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2018_07_01.models.CorsRule] """ _attribute_map = { @@ -431,6 +503,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2018_07_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -440,12 +517,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -464,6 +541,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -472,11 +557,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The blob service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. - :type enabled: bool - :param days: Indicates the number of days that the deleted blob should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted blob should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -495,6 +580,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted blob should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -503,10 +595,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -521,6 +613,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -531,14 +629,14 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_07_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2018_07_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_07_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_07_01.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2018_07_01.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2018_07_01.models.KeyVaultProperties """ _validation = { @@ -559,6 +657,16 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2018_07_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2018_07_01.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2018_07_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -570,9 +678,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -594,6 +702,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -604,10 +717,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -633,6 +746,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2018_07_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -681,6 +800,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -728,6 +849,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -767,6 +890,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -789,9 +914,9 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the + :ivar immutability_period_since_creation_in_days: Required. The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyState @@ -821,6 +946,11 @@ def __init__( immutability_period_since_creation_in_days: int, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: Required. The immutability period for the + blobs in the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -835,9 +965,9 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2018_07_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyState @@ -862,6 +992,11 @@ def __init__( immutability_period_since_creation_in_days: Optional[int] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -874,12 +1009,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -898,6 +1033,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -906,12 +1049,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -928,6 +1071,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -939,20 +1090,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -977,6 +1128,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -988,11 +1155,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -1007,6 +1174,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -1024,9 +1198,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -1045,6 +1219,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -1060,8 +1239,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_07_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2018_07_01.models.TagProperty] """ _validation = { @@ -1079,6 +1258,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2018_07_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -1105,6 +1288,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -1124,9 +1309,9 @@ class ListContainerItem(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -1138,8 +1323,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicyProperties @@ -1195,6 +1380,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_07_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -1211,8 +1403,8 @@ def __init__( class ListContainerItems(msrest.serialization.Model): """The list of blob containers. - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_07_01.models.ListContainerItem] + :ivar value: The list of blob containers. + :vartype value: list[~azure.mgmt.storage.v2018_07_01.models.ListContainerItem] """ _attribute_map = { @@ -1225,6 +1417,10 @@ def __init__( value: Optional[List["ListContainerItem"]] = None, **kwargs ): + """ + :keyword value: The list of blob containers. + :paramtype value: list[~azure.mgmt.storage.v2018_07_01.models.ListContainerItem] + """ super(ListContainerItems, self).__init__(**kwargs) self.value = value @@ -1250,6 +1446,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1257,9 +1455,9 @@ def __init__( class ManagementPoliciesRules(msrest.serialization.Model): """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any """ _attribute_map = { @@ -1272,6 +1470,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(ManagementPoliciesRules, self).__init__(**kwargs) self.policy = policy @@ -1279,9 +1482,9 @@ def __init__( class ManagementPoliciesRulesSetParameter(msrest.serialization.Model): """The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any """ _attribute_map = { @@ -1294,6 +1497,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(ManagementPoliciesRulesSetParameter, self).__init__(**kwargs) self.policy = policy @@ -1301,24 +1509,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_07_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2018_07_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -1347,6 +1555,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2018_07_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1364,18 +1592,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_07_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2018_07_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_07_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2018_07_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2018_07_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2018_07_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_07_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2018_07_01.models.DefaultAction """ _validation = { @@ -1398,6 +1626,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2018_07_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2018_07_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2018_07_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2018_07_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -1408,14 +1651,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_07_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2018_07_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2018_07_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2018_07_01.models.ServiceSpecification """ _attribute_map = { @@ -1434,6 +1677,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2018_07_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2018_07_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1444,14 +1697,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -1470,6 +1723,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1480,8 +1743,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_07_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2018_07_01.models.Operation] """ _attribute_map = { @@ -1494,6 +1757,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2018_07_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -1508,11 +1775,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_07_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2018_07_01.models.ReasonCode """ _validation = { @@ -1532,6 +1799,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2018_07_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -1543,49 +1817,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -1637,6 +1910,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2018_07_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_07_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_07_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -1661,8 +1980,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2018_07_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2018_07_01.models.MetricSpecification] """ _attribute_map = { @@ -1675,6 +1995,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2018_07_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -1686,10 +2011,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the SKU name. Required for account creation; optional for + :ivar name: Required. Gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS". - :type name: str or ~azure.mgmt.storage.v2018_07_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2018_07_01.models.SkuName :ivar tier: Gets the SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2018_07_01.models.SkuTier @@ -1704,9 +2029,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2018_07_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_07_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2018_07_01.models.Restriction] """ _validation = { @@ -1735,6 +2060,15 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the SKU name. Required for account creation; optional for + update. Note that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS". + :paramtype name: str or ~azure.mgmt.storage.v2018_07_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2018_07_01.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1771,6 +2105,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1791,10 +2127,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -1819,6 +2155,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1839,17 +2181,17 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2018_07_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_07_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_07_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2018_07_01.models.ProvisioningState @@ -1888,15 +2230,15 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets + :ivar enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :vartype enable_azure_files_aad_integration: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, @@ -1968,6 +2310,22 @@ def __init__( is_hns_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_07_01.models.Identity + :keyword enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if + sets to true. + :paramtype enable_azure_files_aad_integration: bool + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -1999,8 +2357,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -2024,6 +2382,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -2033,42 +2395,42 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2018_07_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2018_07_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_07_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_07_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets + :vartype encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier + :ivar enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :vartype enable_azure_files_aad_integration: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool """ _validation = { @@ -2109,6 +2471,45 @@ def __init__( is_hns_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2018_07_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_07_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier + :keyword enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if + sets to true. + :paramtype enable_azure_files_aad_integration: bool + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -2154,6 +2555,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -2182,6 +2585,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -2207,6 +2612,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -2224,9 +2631,9 @@ class StorageAccountManagementPolicies(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime """ @@ -2252,6 +2659,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(StorageAccountManagementPolicies, self).__init__(**kwargs) self.policy = policy self.last_modified_time = None @@ -2262,9 +2674,9 @@ class StorageAccountManagementPoliciesRulesProperty(ManagementPoliciesRules): Variables are only populated by the server, and will be ignored when sending a request. - :param policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + :ivar policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: any + :vartype policy: any :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime """ @@ -2284,6 +2696,11 @@ def __init__( policy: Optional[Any] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicies Rules, in JSON format. See more details + in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: any + """ super(StorageAccountManagementPoliciesRulesProperty, self).__init__(policy=policy, **kwargs) self.last_modified_time = None @@ -2293,9 +2710,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2. + :vartype key_name: str """ _validation = { @@ -2312,6 +2729,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -2319,38 +2741,37 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2018_07_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2018_07_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_07_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_07_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets + :vartype encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier + :ivar enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet + :vartype enable_azure_files_aad_integration: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet """ _attribute_map = { @@ -2381,6 +2802,41 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2018_07_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_07_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_07_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_07_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_07_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_07_01.models.AccessTier + :keyword enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if + sets to true. + :paramtype enable_azure_files_aad_integration: bool + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_07_01.models.NetworkRuleSet + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -2415,6 +2871,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2456,6 +2914,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2508,6 +2968,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2551,6 +3013,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2561,8 +3025,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_07_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2018_07_01.models.Usage] """ _attribute_map = { @@ -2575,6 +3039,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2018_07_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -2604,6 +3072,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2614,15 +3084,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_07_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2018_07_01.models.State """ _validation = { @@ -2643,6 +3113,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2018_07_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py index fa211fdcfb1f..f9d371f333e0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,7 +37,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -62,14 +47,14 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -81,21 +66,21 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -104,14 +89,14 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -119,7 +104,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -129,7 +114,7 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -139,7 +124,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -147,7 +132,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -157,18 +142,18 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -182,7 +167,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -190,7 +175,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -198,7 +183,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -206,7 +191,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -216,7 +201,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -226,7 +211,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -236,7 +221,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -246,7 +231,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -258,14 +243,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_LRS = "Premium_LRS" PREMIUM_ZRS = "Premium_ZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -275,7 +260,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py index 7b8267596009..10b9fc1d7be1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py @@ -5,22 +5,582 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,13 +604,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListContainerItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListContainerItems": """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -71,27 +631,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,17 +655,19 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -144,33 +696,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,17 +726,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -222,33 +766,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,16 +796,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -296,28 +832,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,16 +857,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -365,26 +893,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -397,15 +917,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -434,33 +955,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -474,17 +985,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -512,33 +1025,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,18 +1055,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -596,40 +1101,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -639,23 +1131,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -685,32 +1180,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -720,23 +1202,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the @@ -768,31 +1253,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -802,23 +1275,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -848,29 +1324,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -880,24 +1346,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -931,37 +1400,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -971,23 +1430,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1015,36 +1477,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1058,4 +1510,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py index e8ff35acfd3e..44dea58a50b5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py @@ -5,22 +5,108 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-07-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -44,14 +130,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -75,34 +161,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,15 +190,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -145,29 +221,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,4 +245,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_management_policies_operations.py index 44421d592324..a955f9e00034 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2018-03-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountManagementPolicies" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.StorageAccountManagementPolicies": """Gets the data policy rules associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountManagementPolicies, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountManagementPolicies @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPoliciesRulesSetParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountManagementPolicies" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPoliciesRulesSetParameter", + **kwargs: Any + ) -> "_models.StorageAccountManagementPolicies": """Sets the data policy rules associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName :param properties: The data policy rules to set to a storage account. :type properties: ~azure.mgmt.storage.v2018_07_01.models.ManagementPoliciesRulesSetParameter :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPoliciesRulesSetParameter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the data policy rules associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_07_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-03-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py index 934ea1a3c309..bd46ae9ac90f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2018_07_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py index 6ec7114820da..ee61bf4d6ccb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py index d0027934c406..2f3c34d0e6ac 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py @@ -5,25 +5,484 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "geoReplicationStats", + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +506,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_07_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_07_01.models.CheckNameAvailabilityResult @@ -69,30 +529,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +556,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +603,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +631,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2018_07_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +655,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +681,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +710,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +733,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand="geoReplicationStats", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "geoReplicationStats", + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -320,6 +755,7 @@ def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. + The default value is "geoReplicationStats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccount, or the result of cls(response) @@ -331,29 +767,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,16 +792,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -405,32 +832,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -444,19 +861,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -464,34 +885,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -509,17 +925,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -527,8 +944,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_07_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -536,35 +955,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,18 +997,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -613,27 +1029,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -647,16 +1053,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -667,7 +1075,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_07_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountListKeysResult @@ -678,32 +1087,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -717,16 +1116,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -748,32 +1149,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,16 +1178,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -818,32 +1211,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -857,39 +1240,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2018-07-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -902,13 +1278,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -922,15 +1299,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -944,21 +1323,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -970,4 +1342,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py index f0811efef51d..18dc70af1d03 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py index ae1189ceb9e3..e210f7d63839 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json index 8976f08b5bfa..da90b392297c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py index 0174a08f351a..3bc34e0e6c83 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobServicesOperations, ManagementPoliciesOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -41,7 +33,8 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2018_11_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2018_11_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2018_11_01.operations.ManagementPoliciesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2018_11_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -50,60 +43,60 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py index b03b3914c935..46883bec2cf5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py index 09deca61e2ad..dfcd9c84d5f2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobServicesOperations, ManagementPoliciesOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -35,71 +29,76 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2018_11_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2018_11_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2018_11_01.aio.operations.StorageAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2018_11_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2018_11_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2018_11_01.aio.operations.ManagementPoliciesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2018_11_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2018_11_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2018_11_01.aio.operations.BlobContainersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py index 1940f65d2bea..20354f48e01d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -66,27 +71,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -138,33 +136,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -182,8 +170,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -219,33 +210,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,8 +240,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -292,28 +276,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -327,8 +301,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -360,26 +337,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -392,6 +361,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -428,33 +399,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -468,8 +429,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -505,33 +469,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,8 +499,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -588,40 +545,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -631,14 +575,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -676,32 +624,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,14 +646,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -758,31 +697,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -792,14 +719,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -837,29 +768,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -869,14 +790,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -919,37 +844,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -959,14 +874,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1002,36 +921,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1045,4 +954,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py index 7562fad33ec9..10a61fd2e118 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -70,34 +75,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,8 +104,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -139,29 +135,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,4 +159,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py index b06335bcadfc..557bbd26ac15 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py index 7ddde1f8e9e9..9f26fc42e81d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py index 157f14924a9d..96993efcddcf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py index 6db372da1d6d..b50f8b6b2f8b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_11_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_11_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_11_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2018_11_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -311,6 +298,7 @@ async def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. + The default value is "geoReplicationStats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccount, or the result of cls(response) @@ -322,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -395,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -444,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -453,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -498,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -515,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -524,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -600,27 +572,17 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -634,8 +596,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -653,7 +618,8 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_11_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountListKeysResult @@ -664,32 +630,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -703,8 +659,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -733,32 +692,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -772,8 +721,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -802,32 +754,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -841,8 +783,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -854,25 +798,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -885,6 +821,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -904,15 +842,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -926,21 +866,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -952,8 +885,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -979,25 +914,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1009,3 +936,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py index f5f99b4e06cf..457c302cca05 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2018_11_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py index fde008d719f7..400ba7241c71 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py @@ -6,138 +6,72 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import AzureEntityResource - from ._models_py3 import BlobContainer - from ._models_py3 import BlobServiceProperties - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import AzureEntityResource +from ._models_py3 import BlobContainer +from ._models_py3 import BlobServiceProperties +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models.py deleted file mode 100644 index f85be8e03a01..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models.py +++ /dev/null @@ -1,2646 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_11_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_11_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2018_11_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2018_11_01.models.DeleteRetentionPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2018_11_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2018_11_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2018_11_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Integer value indicating the age in days - after creation. - :type days_after_creation_greater_than: int - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after last modification. - - All required parameters must be populated in order to send to Azure. - - :param days_after_modification_greater_than: Required. Integer value indicating the age in days - after last modification. - :type days_after_modification_greater_than: int - """ - - _validation = { - 'days_after_modification_greater_than': {'required': True, 'minimum': 0}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs['days_after_modification_greater_than'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The blob service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. - :type enabled: bool - :param days: Indicates the number of days that the deleted blob should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_11_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_11_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_11_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2018_11_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the - blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'required': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs['immutability_period_since_creation_in_days'] - self.state = None - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2018_11_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_11_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2018_11_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """The list of blob containers. - - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_11_01.models.ListContainerItem] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySnapShot - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Only blockBlob is supported. - :type blob_types: list[str] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2018_11_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterCreation - """ - - _attribute_map = { - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_11_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_11_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2018_11_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_11_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_11_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_11_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2018_11_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_11_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_11_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2018_11_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the SKU name. Required for account creation; optional for - update. Note that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS". - :type name: str or ~azure.mgmt.storage.v2018_11_01.models.SkuName - :ivar tier: Gets the SKU tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2018_11_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2018_11_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_11_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2018_11_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_11_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2018_11_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2018_11_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2018_11_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2018_11_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2018_11_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets - to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2018_11_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_azure_files_aad_integration': {'key': 'properties.azureFilesAadIntegration', 'type': 'bool'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.enable_azure_files_aad_integration = kwargs.get('enable_azure_files_aad_integration', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2018_11_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_11_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the - account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets - to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_azure_files_aad_integration': {'key': 'properties.azureFilesAadIntegration', 'type': 'bool'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_azure_files_aad_integration = kwargs.get('enable_azure_files_aad_integration', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2018_11_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2018_11_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_11_01.models.StorageAccount] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2018_11_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_11_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets - to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'enable_azure_files_aad_integration': {'key': 'properties.azureFilesAadIntegration', 'type': 'bool'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.enable_azure_files_aad_integration = kwargs.get('enable_azure_files_aad_integration', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2018_11_01.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2018_11_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2018_11_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_11_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_11_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py index bf89657db351..f60fbdc8f96b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py @@ -19,31 +19,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2018_11_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2018_11_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +77,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2018_11_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -119,6 +147,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -160,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -179,9 +211,9 @@ class BlobContainer(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -193,8 +225,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyProperties @@ -250,6 +282,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -276,16 +315,16 @@ class BlobServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2018_11_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2018_11_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2018_11_01.models.DeleteRetentionPolicy + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2018_11_01.models.DeleteRetentionPolicy """ _validation = { @@ -311,6 +350,19 @@ def __init__( delete_retention_policy: Optional["DeleteRetentionPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2018_11_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2018_11_01.models.DeleteRetentionPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.cors = cors self.default_service_version = default_service_version @@ -350,6 +402,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -361,22 +415,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2018_11_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -405,6 +459,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2018_11_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -416,9 +488,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2018_11_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2018_11_01.models.CorsRule] """ _attribute_map = { @@ -431,6 +503,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2018_11_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -440,12 +517,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -464,6 +541,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -474,9 +559,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Integer value indicating the age in days + :ivar days_after_creation_greater_than: Required. Integer value indicating the age in days after creation. - :type days_after_creation_greater_than: int + :vartype days_after_creation_greater_than: int """ _validation = { @@ -493,6 +578,11 @@ def __init__( days_after_creation_greater_than: int, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Integer value indicating the age in days + after creation. + :paramtype days_after_creation_greater_than: int + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -502,9 +592,9 @@ class DateAfterModification(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_modification_greater_than: Required. Integer value indicating the age in days + :ivar days_after_modification_greater_than: Required. Integer value indicating the age in days after last modification. - :type days_after_modification_greater_than: int + :vartype days_after_modification_greater_than: int """ _validation = { @@ -521,6 +611,11 @@ def __init__( days_after_modification_greater_than: int, **kwargs ): + """ + :keyword days_after_modification_greater_than: Required. Integer value indicating the age in + days after last modification. + :paramtype days_after_modification_greater_than: int + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than @@ -528,11 +623,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The blob service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. - :type enabled: bool - :param days: Indicates the number of days that the deleted blob should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted blob should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -551,6 +646,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted blob should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -559,10 +661,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -577,6 +679,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -587,14 +695,14 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2018_11_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2018_11_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2018_11_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2018_11_01.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2018_11_01.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2018_11_01.models.KeyVaultProperties """ _validation = { @@ -615,6 +723,16 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2018_11_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2018_11_01.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2018_11_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -626,9 +744,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -650,6 +768,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -660,10 +783,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -689,6 +812,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2018_11_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -737,6 +866,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -784,6 +915,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -823,6 +956,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -845,9 +980,9 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the + :ivar immutability_period_since_creation_in_days: Required. The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyState @@ -877,6 +1012,11 @@ def __init__( immutability_period_since_creation_in_days: int, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: Required. The immutability period for the + blobs in the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -891,9 +1031,9 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2018_11_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyState @@ -918,6 +1058,11 @@ def __init__( immutability_period_since_creation_in_days: Optional[int] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -930,12 +1075,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -954,6 +1099,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -962,12 +1115,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -984,6 +1137,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -995,20 +1156,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -1033,6 +1194,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -1044,11 +1221,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -1063,6 +1240,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -1080,9 +1264,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -1101,6 +1285,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -1116,8 +1305,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2018_11_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2018_11_01.models.TagProperty] """ _validation = { @@ -1135,6 +1324,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2018_11_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -1161,6 +1354,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -1180,9 +1375,9 @@ class ListContainerItem(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -1194,8 +1389,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicyProperties @@ -1251,6 +1446,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2018_11_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -1267,8 +1469,8 @@ def __init__( class ListContainerItems(msrest.serialization.Model): """The list of blob containers. - :param value: The list of blob containers. - :type value: list[~azure.mgmt.storage.v2018_11_01.models.ListContainerItem] + :ivar value: The list of blob containers. + :vartype value: list[~azure.mgmt.storage.v2018_11_01.models.ListContainerItem] """ _attribute_map = { @@ -1281,6 +1483,10 @@ def __init__( value: Optional[List["ListContainerItem"]] = None, **kwargs ): + """ + :keyword value: The list of blob containers. + :paramtype value: list[~azure.mgmt.storage.v2018_11_01.models.ListContainerItem] + """ super(ListContainerItems, self).__init__(**kwargs) self.value = value @@ -1306,6 +1512,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1325,9 +1533,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySchema """ _validation = { @@ -1351,6 +1559,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -1359,10 +1572,10 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySnapShot + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySnapShot """ _attribute_map = { @@ -1377,6 +1590,12 @@ def __init__( snapshot: Optional["ManagementPolicySnapShot"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicySnapShot + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -1385,14 +1604,14 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification + :vartype tier_to_archive: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification """ _attribute_map = { @@ -1409,6 +1628,16 @@ def __init__( delete: Optional["DateAfterModification"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterModification + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -1420,10 +1649,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyFilter """ _validation = { @@ -1442,6 +1671,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -1452,10 +1687,10 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Only blockBlob is supported. - :type blob_types: list[str] + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Only blockBlob is supported. + :vartype blob_types: list[str] """ _validation = { @@ -1474,6 +1709,12 @@ def __init__( prefix_match: Optional[List[str]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Only blockBlob is supported. + :paramtype blob_types: list[str] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -1484,15 +1725,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2018_11_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2018_11_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyDefinition """ _validation = { @@ -1517,6 +1758,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2018_11_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -1529,9 +1781,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyRule] """ _validation = { @@ -1548,6 +1800,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -1555,8 +1812,8 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterCreation """ _attribute_map = { @@ -1569,6 +1826,10 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2018_11_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.delete = delete @@ -1576,24 +1837,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2018_11_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2018_11_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -1622,6 +1883,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2018_11_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1639,18 +1920,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2018_11_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2018_11_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2018_11_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2018_11_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2018_11_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2018_11_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2018_11_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2018_11_01.models.DefaultAction """ _validation = { @@ -1673,6 +1954,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2018_11_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2018_11_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2018_11_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2018_11_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -1683,14 +1979,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2018_11_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2018_11_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2018_11_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2018_11_01.models.ServiceSpecification """ _attribute_map = { @@ -1709,6 +2005,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2018_11_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2018_11_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1719,14 +2025,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -1745,6 +2051,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1755,8 +2071,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2018_11_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2018_11_01.models.Operation] """ _attribute_map = { @@ -1769,6 +2085,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2018_11_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -1783,11 +2103,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2018_11_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2018_11_01.models.ReasonCode """ _validation = { @@ -1807,6 +2127,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2018_11_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -1818,49 +2145,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -1912,6 +2238,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2018_11_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2018_11_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2018_11_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -1936,8 +2308,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2018_11_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2018_11_01.models.MetricSpecification] """ _attribute_map = { @@ -1950,6 +2323,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2018_11_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -1961,10 +2339,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the SKU name. Required for account creation; optional for + :ivar name: Required. Gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS". - :type name: str or ~azure.mgmt.storage.v2018_11_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2018_11_01.models.SkuName :ivar tier: Gets the SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2018_11_01.models.SkuTier @@ -1979,9 +2357,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2018_11_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2018_11_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2018_11_01.models.Restriction] """ _validation = { @@ -2010,6 +2388,15 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the SKU name. Required for account creation; optional for + update. Note that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS". + :paramtype name: str or ~azure.mgmt.storage.v2018_11_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2018_11_01.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -2046,6 +2433,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -2066,10 +2455,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -2094,6 +2483,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -2114,17 +2509,17 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2018_11_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_11_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_11_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2018_11_01.models.ProvisioningState @@ -2163,15 +2558,15 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets + :ivar enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :vartype enable_azure_files_aad_integration: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2018_11_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, @@ -2243,6 +2638,22 @@ def __init__( is_hns_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_11_01.models.Identity + :keyword enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if + sets to true. + :paramtype enable_azure_files_aad_integration: bool + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -2274,8 +2685,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -2299,6 +2710,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -2308,42 +2723,42 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2018_11_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2018_11_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_11_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_11_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If left unspecified the + :vartype custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. If left unspecified the account encryption settings will remain the same. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets + :vartype encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier + :ivar enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :vartype enable_azure_files_aad_integration: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool """ _validation = { @@ -2384,6 +2799,45 @@ def __init__( is_hns_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2018_11_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_11_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. If left unspecified the + account encryption settings will remain the same. The default setting is unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier + :keyword enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if + sets to true. + :paramtype enable_azure_files_aad_integration: bool + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -2429,6 +2883,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -2457,6 +2913,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -2482,6 +2940,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -2491,9 +2951,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2. + :vartype key_name: str """ _validation = { @@ -2510,6 +2970,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -2517,38 +2982,37 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2018_11_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2018_11_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2018_11_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2018_11_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier - :param enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets + :vartype encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier + :ivar enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if sets to true. - :type enable_azure_files_aad_integration: bool - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet + :vartype enable_azure_files_aad_integration: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet """ _attribute_map = { @@ -2579,6 +3043,41 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2018_11_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2018_11_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2018_11_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2018_11_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2018_11_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2018_11_01.models.AccessTier + :keyword enable_azure_files_aad_integration: Enables Azure Files AAD Integration for SMB if + sets to true. + :paramtype enable_azure_files_aad_integration: bool + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2018_11_01.models.NetworkRuleSet + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -2613,6 +3112,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2654,6 +3155,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2706,6 +3209,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2749,6 +3254,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2759,8 +3266,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2018_11_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2018_11_01.models.Usage] """ _attribute_map = { @@ -2773,6 +3280,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2018_11_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -2802,6 +3313,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2812,15 +3325,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2018_11_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2018_11_01.models.State """ _validation = { @@ -2841,6 +3354,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2018_11_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py index d3fb4b16cb77..f4520a5730d4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,7 +37,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -62,14 +47,14 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -81,21 +66,21 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -104,14 +89,14 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -119,7 +104,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -129,7 +114,7 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -139,7 +124,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -147,7 +132,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -157,18 +142,18 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -182,7 +167,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -190,7 +175,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -198,7 +183,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -206,7 +191,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -216,13 +201,13 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -232,7 +217,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -242,7 +227,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -252,7 +237,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -264,14 +249,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PREMIUM_LRS = "Premium_LRS" PREMIUM_ZRS = "Premium_ZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -281,7 +266,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py index a15dc4ad3d45..433c07e2f44a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py @@ -5,22 +5,582 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,13 +604,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListContainerItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListContainerItems": """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -71,27 +631,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,17 +655,19 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -144,33 +696,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,17 +730,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -226,33 +770,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -266,16 +800,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -300,28 +836,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -335,16 +861,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -369,26 +897,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -401,15 +921,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -438,33 +959,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -478,17 +989,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -516,33 +1029,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -556,18 +1059,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -600,40 +1105,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -643,23 +1135,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -689,32 +1184,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -724,23 +1206,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the @@ -772,31 +1257,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -806,23 +1279,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -852,29 +1328,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -884,24 +1350,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -935,37 +1404,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -975,23 +1434,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1019,36 +1481,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1062,4 +1514,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py index b70b3b64a36b..d0b7699a81b0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py @@ -5,22 +5,108 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-11-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -44,14 +130,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -75,34 +161,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,15 +190,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -145,29 +221,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,4 +245,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py index 94ab07e919d9..a1d762224250 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py index f175b84def04..3eb2331f155f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2018_11_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py index 84cf8529abd8..aaf92c328e39 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py index a4ec5619f98f..b56a305437a8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py @@ -5,25 +5,513 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "geoReplicationStats", + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +535,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2018_11_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_11_01.models.CheckNameAvailabilityResult @@ -69,30 +558,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +585,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +632,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +660,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2018_11_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +684,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +710,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +739,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +762,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand="geoReplicationStats", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "geoReplicationStats", + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -320,6 +784,7 @@ def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. + The default value is "geoReplicationStats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccount, or the result of cls(response) @@ -331,29 +796,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,16 +821,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -405,32 +861,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -444,19 +890,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -464,34 +914,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -509,17 +954,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -527,8 +973,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2018_11_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -536,35 +984,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,18 +1026,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -613,27 +1058,17 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -647,16 +1082,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -667,7 +1104,8 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1 or key2. - :type regenerate_key: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2018_11_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountListKeysResult @@ -678,32 +1116,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -717,16 +1145,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -748,32 +1178,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccountSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,16 +1207,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -818,32 +1240,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -857,39 +1269,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2018-11-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -902,13 +1307,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -922,15 +1328,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -944,21 +1352,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -970,15 +1371,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -998,25 +1400,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1028,3 +1422,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py index cc7aa7866b9c..68bab2805616 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py index 9b6b24188f5b..15c25a75bf29 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json index f9d6e88fcd3a..6e4b0d7dd7e1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py index 19be09e6d40c..e8d696cdc673 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobServicesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -43,7 +33,8 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2019_04_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2019_04_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2019_04_01.operations.ManagementPoliciesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2019_04_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -56,64 +47,62 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py index e634518a9bf0..9b0baac5d7cd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py index 9c1e69ebb08b..d2bb1d9cf954 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobServicesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, Operations, SkusOperations, StorageAccountsOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -37,15 +29,18 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2019_04_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2019_04_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2019_04_01.aio.operations.StorageAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2019_04_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2019_04_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2019_04_01.aio.operations.ManagementPoliciesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2019_04_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2019_04_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2019_04_01.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations :vartype file_services: azure.mgmt.storage.v2019_04_01.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations @@ -54,62 +49,62 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py index 8e2b43d5b6a9..df92bd141852 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -172,33 +178,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,8 +212,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -253,33 +252,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,8 +282,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -326,28 +318,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,8 +343,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,26 +379,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,6 +403,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -462,33 +441,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,8 +471,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -539,33 +511,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,8 +541,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -622,40 +587,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,14 +617,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -710,32 +666,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -745,14 +688,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -792,31 +739,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -826,14 +761,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -871,29 +810,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -903,14 +832,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -953,37 +886,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -993,14 +916,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1036,36 +963,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,4 +996,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py index 96d7966352d6..9b9a19b38713 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py index b7aaf2ea2584..a87dce3a231b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py index 0e341fb080e8..cdb1f4575bba 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -77,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +134,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -171,33 +177,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -215,8 +211,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -252,33 +251,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -292,8 +281,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -325,28 +317,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,8 +342,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -393,28 +378,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,3 +401,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py index 9589da58dbde..1c282345d7c3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py index 03dfdc2e6bd9..8cc150105969 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py index f9f5d92a97dc..260d736d83bd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py index b401f6df462d..7991466668f9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2019_04_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_04_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_04_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_04_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -311,6 +298,7 @@ async def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. + The default value is "geoReplicationStats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccount, or the result of cls(response) @@ -322,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -395,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -444,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -453,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -498,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -515,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -524,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -592,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -604,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -640,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -660,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2019_04_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountListKeysResult @@ -671,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -710,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -740,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -779,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -809,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -848,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -861,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -892,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -911,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -933,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -959,8 +892,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -986,25 +921,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1016,3 +943,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py index f962a6c9f6f1..5b337768b066 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_04_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py index 47d4091fdbbd..39bc5b401be6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py @@ -6,158 +6,82 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import Restriction - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageSkuListResult - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import Restriction # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Restriction +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageSkuListResult +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py deleted file mode 100644 index e743f1ef8fcb..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py +++ /dev/null @@ -1,3112 +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 msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2019_04_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2019_04_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2019_04_01.models.ActiveDirectoryProperties - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2019_04_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2019_04_01.models.DeleteRetentionPolicy - :param automatic_snapshot_policy_enabled: Automatic Snapshot is enabled if set to true. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2019_04_01.models.ChangeFeed - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2019_04_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2019_04_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2019_04_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after last modification. - - All required parameters must be populated in order to send to Azure. - - :param days_after_modification_greater_than: Required. Value indicating the age in days after - last modification. - :type days_after_modification_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs['days_after_modification_greater_than'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The blob service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. - :type enabled: bool - :param days: Indicates the number of days that the deleted blob should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2019_04_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2019_04_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2019_04_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService - :ivar table: The encryption function of the table storage service. - :vartype table: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService - :ivar queue: The encryption function of the queue storage service. - :vartype queue: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService - """ - - _validation = { - 'table': {'readonly': True}, - 'queue': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = None - self.queue = None - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). - :type share_quota: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 5120, 'minimum': 1}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). - :type share_quota: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 5120, 'minimum': 1}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2019_04_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the - blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'required': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs['immutability_period_since_creation_in_days'] - self.state = None - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2019_04_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyState - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2019_04_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2019_04_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySnapShot - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Only blockBlob is supported. - :type blob_types: list[str] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2019_04_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterCreation - """ - - _attribute_map = { - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2019_04_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2019_04_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2019_04_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2019_04_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2019_04_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2019_04_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2019_04_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2019_04_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2019_04_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2019_04_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the SKU name. Required for account creation; optional for - update. Note that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2019_04_01.models.SkuName - :ivar tier: Gets the SKU tier. This is based on the SKU name. Possible values include: - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2019_04_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2019_04_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2019_04_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2019_04_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_04_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2019_04_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2019_04_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2019_04_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2019_04_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2019_04_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2019_04_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2019_04_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_04_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2019_04_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2019_04_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2019_04_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_04_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.Sku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2019_04_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2019_04_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2019_04_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2019_04_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py index e0f440f9de9a..b15703ea8ec0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py @@ -19,31 +19,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2019_04_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2019_04_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -77,6 +77,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2019_04_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -93,19 +121,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -137,6 +165,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -177,6 +221,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -218,6 +264,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -227,12 +275,12 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2019_04_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2019_04_01.models.ActiveDirectoryProperties """ @@ -252,6 +300,15 @@ def __init__( active_directory_properties: Optional["ActiveDirectoryProperties"] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2019_04_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2019_04_01.models.ActiveDirectoryProperties + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -272,9 +329,9 @@ class BlobContainer(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -286,8 +343,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyProperties @@ -343,6 +400,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -377,6 +441,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -394,20 +460,20 @@ class BlobServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2019_04_01.models.DeleteRetentionPolicy - :param automatic_snapshot_policy_enabled: Automatic Snapshot is enabled if set to true. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2019_04_01.models.ChangeFeed + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2019_04_01.models.DeleteRetentionPolicy + :ivar automatic_snapshot_policy_enabled: Automatic Snapshot is enabled if set to true. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2019_04_01.models.ChangeFeed """ _validation = { @@ -437,6 +503,23 @@ def __init__( change_feed: Optional["ChangeFeed"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2019_04_01.models.DeleteRetentionPolicy + :keyword automatic_snapshot_policy_enabled: Automatic Snapshot is enabled if set to true. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2019_04_01.models.ChangeFeed + """ super(BlobServiceProperties, self).__init__(**kwargs) self.cors = cors self.default_service_version = default_service_version @@ -448,8 +531,8 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool """ _attribute_map = { @@ -462,6 +545,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled @@ -499,6 +586,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -508,17 +597,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] """ _attribute_map = { @@ -537,6 +626,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -549,22 +651,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2019_04_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -593,6 +695,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2019_04_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -604,9 +724,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2019_04_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2019_04_01.models.CorsRule] """ _attribute_map = { @@ -619,6 +739,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2019_04_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -628,12 +753,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -652,6 +777,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -662,9 +795,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -681,6 +814,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -690,9 +828,9 @@ class DateAfterModification(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_modification_greater_than: Required. Value indicating the age in days after + :ivar days_after_modification_greater_than: Required. Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float + :vartype days_after_modification_greater_than: float """ _validation = { @@ -709,6 +847,11 @@ def __init__( days_after_modification_greater_than: float, **kwargs ): + """ + :keyword days_after_modification_greater_than: Required. Value indicating the age in days after + last modification. + :paramtype days_after_modification_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than @@ -716,11 +859,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The blob service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. - :type enabled: bool - :param days: Indicates the number of days that the deleted blob should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted blob should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -739,6 +882,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted blob should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -747,10 +897,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -765,6 +915,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -775,14 +931,14 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2019_04_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2019_04_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2019_04_01.models.KeySource - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2019_04_01.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.storage.v2019_04_01.models.KeySource + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2019_04_01.models.KeyVaultProperties """ _validation = { @@ -803,6 +959,16 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2019_04_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2019_04_01.models.KeySource + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2019_04_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -814,9 +980,9 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. @@ -838,6 +1004,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -848,10 +1019,10 @@ class EncryptionServices(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService :ivar table: The encryption function of the table storage service. :vartype table: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService :ivar queue: The encryption function of the queue storage service. @@ -877,6 +1048,12 @@ def __init__( file: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2019_04_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -925,6 +1102,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -955,6 +1134,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -972,10 +1153,10 @@ class FileServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules """ _validation = { @@ -997,6 +1178,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + """ super(FileServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -1018,11 +1205,11 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). - :type share_quota: int + :vartype share_quota: int """ _validation = { @@ -1051,6 +1238,13 @@ def __init__( share_quota: Optional[int] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). + :paramtype share_quota: int + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1074,11 +1268,11 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). - :type share_quota: int + :vartype share_quota: int """ _validation = { @@ -1107,6 +1301,13 @@ def __init__( share_quota: Optional[int] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). + :paramtype share_quota: int + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1139,6 +1340,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1182,6 +1385,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -1221,6 +1426,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1243,9 +1450,9 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: Required. The immutability period for the + :ivar immutability_period_since_creation_in_days: Required. The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyState @@ -1275,6 +1482,11 @@ def __init__( immutability_period_since_creation_in_days: int, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: Required. The immutability period for the + blobs in the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -1289,9 +1501,9 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2019_04_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyState @@ -1316,6 +1528,11 @@ def __init__( immutability_period_since_creation_in_days: Optional[int] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -1328,12 +1545,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -1352,6 +1569,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -1360,12 +1585,12 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of key vault. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -1382,6 +1607,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -1393,20 +1626,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -1431,6 +1664,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -1442,11 +1691,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -1461,6 +1710,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -1478,9 +1734,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -1499,6 +1755,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -1514,8 +1775,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2019_04_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2019_04_01.models.TagProperty] """ _validation = { @@ -1533,6 +1794,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2019_04_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -1559,6 +1824,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -1578,9 +1845,9 @@ class ListContainerItem(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param public_access: Specifies whether data in the container may be accessed publicly and the + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -1592,8 +1859,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicyProperties @@ -1649,6 +1916,13 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2019_04_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.public_access = public_access self.last_modified_time = None @@ -1688,6 +1962,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1714,6 +1990,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1733,9 +2011,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySchema """ _validation = { @@ -1759,6 +2037,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -1767,10 +2050,10 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySnapShot + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySnapShot """ _attribute_map = { @@ -1785,6 +2068,12 @@ def __init__( snapshot: Optional["ManagementPolicySnapShot"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicySnapShot + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -1793,14 +2082,14 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification + :vartype tier_to_archive: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification """ _attribute_map = { @@ -1817,6 +2106,16 @@ def __init__( delete: Optional["DateAfterModification"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterModification + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -1828,10 +2127,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyFilter """ _validation = { @@ -1850,6 +2149,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -1860,10 +2165,10 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Only blockBlob is supported. - :type blob_types: list[str] + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Only blockBlob is supported. + :vartype blob_types: list[str] """ _validation = { @@ -1882,6 +2187,12 @@ def __init__( prefix_match: Optional[List[str]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Only blockBlob is supported. + :paramtype blob_types: list[str] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -1892,15 +2203,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2019_04_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2019_04_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyDefinition """ _validation = { @@ -1925,6 +2236,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2019_04_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -1937,9 +2259,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyRule] """ _validation = { @@ -1956,6 +2278,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -1963,8 +2290,8 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterCreation """ _attribute_map = { @@ -1977,6 +2304,10 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2019_04_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.delete = delete @@ -1984,24 +2315,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2019_04_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2019_04_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -2030,6 +2361,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2019_04_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2047,18 +2398,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2019_04_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2019_04_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2019_04_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2019_04_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2019_04_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2019_04_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2019_04_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2019_04_01.models.DefaultAction """ _validation = { @@ -2081,6 +2432,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2019_04_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2019_04_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2019_04_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2019_04_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -2091,14 +2457,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2019_04_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2019_04_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2019_04_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2019_04_01.models.ServiceSpecification """ _attribute_map = { @@ -2117,6 +2483,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2019_04_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2019_04_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -2127,14 +2503,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -2153,6 +2529,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2163,8 +2549,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2019_04_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.Operation] """ _attribute_map = { @@ -2177,6 +2563,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2019_04_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -2191,11 +2581,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2019_04_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2019_04_01.models.ReasonCode """ _validation = { @@ -2215,6 +2605,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2019_04_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -2226,49 +2623,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -2320,6 +2716,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2019_04_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2019_04_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2019_04_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -2344,8 +2786,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2019_04_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2019_04_01.models.MetricSpecification] """ _attribute_map = { @@ -2358,6 +2801,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2019_04_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -2369,11 +2817,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the SKU name. Required for account creation; optional for + :ivar name: Required. Gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2019_04_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2019_04_01.models.SkuName :ivar tier: Gets the SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2019_04_01.models.SkuTier @@ -2388,9 +2836,9 @@ class Sku(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2019_04_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2019_04_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2019_04_01.models.Restriction] """ _validation = { @@ -2419,6 +2867,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the SKU name. Required for account creation; optional for + update. Note that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2019_04_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2019_04_01.models.Restriction] + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -2455,6 +2913,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -2475,10 +2935,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -2503,6 +2963,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -2523,17 +2989,17 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2019_04_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_04_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2019_04_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2019_04_01.models.ProvisioningState @@ -2572,37 +3038,37 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2019_04_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _validation = { @@ -2677,6 +3143,39 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2019_04_01.models.Identity + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -2712,8 +3211,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -2737,6 +3236,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -2746,60 +3249,60 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2019_04_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2019_04_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_04_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2019_04_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _validation = { @@ -2848,6 +3351,62 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2019_04_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2019_04_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -2897,6 +3456,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -2925,6 +3486,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -2955,6 +3518,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2965,9 +3530,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -2984,6 +3549,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -2991,55 +3561,54 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2019_04_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2019_04_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_04_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2019_04_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _attribute_map = { @@ -3078,6 +3647,58 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2019_04_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2019_04_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2019_04_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2019_04_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2019_04_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2019_04_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2019_04_01.models.LargeFileSharesState + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2019_04_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -3116,6 +3737,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -3157,6 +3780,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -3209,6 +3834,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -3252,6 +3879,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -3262,8 +3891,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2019_04_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.Usage] """ _attribute_map = { @@ -3276,6 +3905,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2019_04_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -3305,6 +3938,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -3315,15 +3950,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2019_04_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2019_04_01.models.State """ _validation = { @@ -3344,6 +3979,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2019_04_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py index 5f6cef7cbf5d..4b237ba27fc4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,7 +26,7 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -52,7 +37,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -62,14 +47,14 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -77,7 +62,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -89,21 +74,21 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -112,14 +97,14 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -127,7 +112,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -137,14 +122,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -154,7 +139,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -162,7 +147,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -172,18 +157,18 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -192,7 +177,7 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -206,7 +191,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -214,7 +199,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -222,7 +207,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -230,7 +215,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -240,13 +225,13 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -256,7 +241,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -266,7 +251,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -276,7 +261,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -290,14 +275,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -307,7 +292,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py index 23f28242e1da..b7f6d089d084 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py @@ -5,23 +5,593 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,16 +615,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - skip_token=None, # type: Optional[str] - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + skip_token: Optional[str] = None, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -83,42 +653,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,20 +703,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -178,33 +746,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,17 +780,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -260,33 +820,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,16 +850,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -334,28 +886,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +911,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -403,26 +947,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,15 +971,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -472,33 +1009,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,17 +1039,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -550,33 +1079,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -590,18 +1109,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -634,40 +1155,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,23 +1185,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -723,32 +1234,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,23 +1256,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the @@ -806,31 +1307,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -840,23 +1329,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -886,29 +1378,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -918,24 +1400,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -969,37 +1454,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1009,23 +1484,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1053,36 +1531,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,4 +1564,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py index 4890ee64be3e..6ac5cfd910a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-04-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -71,36 +192,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +236,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +273,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +302,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +333,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +357,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py index 2c2273ea00fc..f7fff262cc16 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-04-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py index 3c3acb2c599c..a17236994e26 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py @@ -5,23 +5,237 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +259,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - skip_token=None, # type: Optional[str] - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + skip_token: Optional[str] = None, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -82,42 +296,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + maxpagesize=maxpagesize, + filter=filter, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,20 +346,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -177,33 +389,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -221,17 +423,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -259,33 +463,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,16 +493,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -333,28 +529,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +554,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -402,28 +590,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,3 +613,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py index 326dcbc0444e..50bb2ab1497f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py index 2957ae6212fb..2e8ae2a5d150 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2019_04_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py index 59390efad163..1734fbd999e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py index 952d60742c41..eefd33b38609 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py @@ -5,25 +5,517 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "geoReplicationStats", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +539,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2019_04_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_04_01.models.CheckNameAvailabilityResult @@ -69,30 +562,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +589,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +636,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +664,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_04_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +688,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +714,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +743,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +766,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand="geoReplicationStats", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "geoReplicationStats", + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -320,6 +788,7 @@ def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. + The default value is "geoReplicationStats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccount, or the result of cls(response) @@ -331,29 +800,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,16 +825,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -405,32 +865,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -444,19 +894,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -464,34 +918,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -509,17 +958,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -527,8 +977,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -536,35 +988,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,19 +1030,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -605,7 +1054,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -617,29 +1067,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -653,16 +1092,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -674,7 +1115,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2019_04_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountListKeysResult @@ -685,32 +1127,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -724,16 +1156,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -755,32 +1189,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccountSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -794,16 +1218,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -825,32 +1251,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -864,39 +1280,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2019-04-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -909,13 +1318,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -929,15 +1339,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -951,21 +1363,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -977,15 +1382,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1005,25 +1411,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1035,3 +1433,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py index daffcc3e1e54..02358118a534 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py index 5d0336a6e4cd..cde92359b1cf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json index 25973088a8c5..a943b8207251 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py index 00cd7a84ebbf..e0062f15a47d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py @@ -6,41 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -52,17 +33,23 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2019_06_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2019_06_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2019_06_01.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2019_06_01.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2019_06_01.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2019_06_01.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2019_06_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2019_06_01.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2019_06_01.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2019_06_01.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2019_06_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2019_06_01.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2019_06_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2019_06_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -83,82 +70,71 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py index 61c92958ab1e..25aa6326ab22 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py index 60163085e993..2c4ec8aa1042 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py @@ -6,39 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -46,25 +29,33 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2019_06_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2019_06_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2019_06_01.aio.operations.StorageAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2019_06_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2019_06_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2019_06_01.aio.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2019_06_01.aio.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2019_06_01.aio.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2019_06_01.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2019_06_01.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2019_06_01.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2019_06_01.aio.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2019_06_01.aio.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2019_06_01.aio.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2019_06_01.aio.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2019_06_01.aio.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2019_06_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2019_06_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2019_06_01.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations :vartype file_services: azure.mgmt.storage.v2019_06_01.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations @@ -81,80 +72,71 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py index 9e80dd5aa03c..896fdc20b997 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2019_06_01.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -172,33 +178,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,8 +212,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -253,33 +252,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,8 +282,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -326,28 +318,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,8 +343,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,26 +379,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,6 +403,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -462,33 +441,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,8 +471,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -539,33 +511,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,8 +541,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -622,40 +587,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,14 +617,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -710,32 +666,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -745,14 +688,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -792,31 +739,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -826,14 +761,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -871,29 +810,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -903,14 +832,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -953,37 +886,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -993,14 +916,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1036,36 +963,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,4 +996,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py index 7fb117f12140..2ef9919a351e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -106,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -127,7 +127,8 @@ async def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,39 +141,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -181,8 +172,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,7 +195,8 @@ async def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName :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 @@ -212,34 +207,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -247,6 +232,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -263,8 +250,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -272,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -314,12 +300,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py index 39e0cc4125b0..56ec56755b54 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py index 419100afefae..a5a7c64057ad 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def put( self, resource_group_name: str, @@ -77,39 +83,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -122,8 +118,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -159,39 +158,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -200,8 +189,11 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,34 +225,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -269,8 +251,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -287,8 +272,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -296,36 +283,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -343,6 +327,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py index 4c99ace8e42b..07640499f9e2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py index 09a2512ba8db..c2f503a5c593 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_restore_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -65,11 +71,13 @@ def list( :param filter: Optional. When specified, only share names starting with the filter will be listed. :type filter: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "deleted". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -77,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -171,33 +178,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -215,8 +212,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -252,33 +252,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -292,8 +282,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -316,7 +309,8 @@ async def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FileShare, or the result of cls(response) @@ -328,30 +322,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,8 +348,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -398,28 +384,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,6 +408,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def restore( self, resource_group_name: str, @@ -466,33 +444,23 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -504,3 +472,4 @@ async def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py index 29066d82165c..756f539d94f1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py index f0293809a7f1..2affc86e8a61 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -148,34 +155,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -184,8 +181,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -219,39 +219,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -260,8 +250,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -291,37 +284,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py index 299e369b90b8..160908fe6d83 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py index 7d02829dc493..89be934bc5c6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -217,39 +217,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -258,8 +248,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -289,37 +282,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py index 456ab602b2fe..14f2ca7677da 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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_list_by_storage_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_account( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,4 +94,6 @@ async def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py index f69485f03047..46d70814540f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -75,33 +81,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +111,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -151,33 +150,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,8 +180,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,28 +216,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,8 +241,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -292,28 +277,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -326,6 +301,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -351,7 +328,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListQueueResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -359,40 +337,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -410,6 +385,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py index 614648ded66c..a984ceeefab5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueueServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py index b83745e95012..3bc5b7c854cd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py index a4f8a87c0c7b..b505bfb261fd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -323,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -396,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -445,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -516,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -593,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -605,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -661,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult @@ -672,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -741,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -810,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -862,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -893,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -912,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -934,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -960,6 +892,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore async def _restore_blob_ranges_initial( @@ -974,32 +907,22 @@ async def _restore_blob_ranges_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,8 +940,11 @@ async def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async async def begin_restore_blob_ranges( self, resource_group_name: str, @@ -1039,15 +965,20 @@ async def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1059,27 +990,21 @@ async def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1091,8 +1016,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -1118,25 +1045,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1148,3 +1067,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py index ca6d307d82d8..4956d388ba97 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -71,28 +77,18 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +102,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,28 +137,18 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,8 +162,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,28 +197,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +222,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -272,28 +257,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,6 +281,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -323,7 +300,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListTableResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -331,36 +309,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -378,6 +353,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py index e73a0904d485..4f7b036d5c7d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TableServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py index 5241dd42f118..9ae1292bcb34 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2019_06_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py index 5fe019e18f9c..8f8f46732b09 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py @@ -6,244 +6,125 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobInventoryPolicy - from ._models_py3 import BlobInventoryPolicyDefinition - from ._models_py3 import BlobInventoryPolicyFilter - from ._models_py3 import BlobInventoryPolicyRule - from ._models_py3 import BlobInventoryPolicySchema - from ._models_py3 import BlobRestoreParameters - from ._models_py3 import BlobRestoreRange - from ._models_py3 import BlobRestoreStatus - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import DeletedShare - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionScope - from ._models_py3 import EncryptionScopeKeyVaultProperties - from ._models_py3 import EncryptionScopeListResult - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LastAccessTimeTrackingPolicy - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListBlobInventoryPolicy - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListQueue - from ._models_py3 import ListQueueResource - from ._models_py3 import ListQueueServices - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ListTableResource - from ._models_py3 import ListTableServices - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import ManagementPolicyVersion - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import ObjectReplicationPolicies - from ._models_py3 import ObjectReplicationPolicy - from ._models_py3 import ObjectReplicationPolicyFilter - from ._models_py3 import ObjectReplicationPolicyRule - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import QueueServiceProperties - from ._models_py3 import Resource - from ._models_py3 import RestorePolicyProperties - from ._models_py3 import Restriction - from ._models_py3 import RoutingPreference - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuInformation - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountInternetEndpoints - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountMicrosoftEndpoints - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageQueue - from ._models_py3 import StorageSkuListResult - from ._models_py3 import SystemData - from ._models_py3 import Table - from ._models_py3 import TableServiceProperties - from ._models_py3 import TagFilter - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobInventoryPolicy # type: ignore - from ._models import BlobInventoryPolicyDefinition # type: ignore - from ._models import BlobInventoryPolicyFilter # type: ignore - from ._models import BlobInventoryPolicyRule # type: ignore - from ._models import BlobInventoryPolicySchema # type: ignore - from ._models import BlobRestoreParameters # type: ignore - from ._models import BlobRestoreRange # type: ignore - from ._models import BlobRestoreStatus # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import DeletedShare # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionScope # type: ignore - from ._models import EncryptionScopeKeyVaultProperties # type: ignore - from ._models import EncryptionScopeListResult # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LastAccessTimeTrackingPolicy # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListBlobInventoryPolicy # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListQueue # type: ignore - from ._models import ListQueueResource # type: ignore - from ._models import ListQueueServices # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ListTableResource # type: ignore - from ._models import ListTableServices # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import ManagementPolicyVersion # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import ObjectReplicationPolicies # type: ignore - from ._models import ObjectReplicationPolicy # type: ignore - from ._models import ObjectReplicationPolicyFilter # type: ignore - from ._models import ObjectReplicationPolicyRule # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import QueueServiceProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import RestorePolicyProperties # type: ignore - from ._models import Restriction # type: ignore - from ._models import RoutingPreference # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountInternetEndpoints # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountMicrosoftEndpoints # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageQueue # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import Table # type: ignore - from ._models import TableServiceProperties # type: ignore - from ._models import TagFilter # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py deleted file mode 100644 index ac6432e96daf..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py +++ /dev/null @@ -1,4921 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2019_06_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2019_06_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2019_06_01.models.ActiveDirectoryProperties - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2019_06_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobInventoryPolicy(Resource): - """The storage account blob inventory policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.storage.v2019_06_01.models.SystemData - :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. - :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicy, self).__init__(**kwargs) - self.system_data = None - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class BlobInventoryPolicyDefinition(msrest.serialization.Model): - """An object that defines the blob inventory rule. Each definition consists of a set of filters. - - All required parameters must be populated in order to send to Azure. - - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyFilter - """ - - _validation = { - 'filters': {'required': True}, - } - - _attribute_map = { - 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) - self.filters = kwargs['filters'] - - -class BlobInventoryPolicyFilter(msrest.serialization.Model): - """An object that defines the blob inventory rule filter conditions. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, - 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.include_blob_versions = kwargs.get('include_blob_versions', None) - self.include_snapshots = kwargs.get('include_snapshots', None) - - -class BlobInventoryPolicyRule(msrest.serialization.Model): - """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyDefinition - """ - - _validation = { - 'enabled': {'required': True}, - 'name': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.name = kwargs['name'] - self.definition = kwargs['definition'] - - -class BlobInventoryPolicySchema(msrest.serialization.Model): - """The storage account blob inventory policy rules. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be - pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2019_06_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied - when it is enabled. - :type rules: list[~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyRule] - """ - - _validation = { - 'enabled': {'required': True}, - 'destination': {'required': True}, - 'type': {'required': True}, - 'rules': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicySchema, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.destination = kwargs['destination'] - self.type = kwargs['type'] - self.rules = kwargs['rules'] - - -class BlobRestoreParameters(msrest.serialization.Model): - """Blob restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] - """ - - _validation = { - 'time_to_restore': {'required': True}, - 'blob_ranges': {'required': True}, - } - - _attribute_map = { - 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, - 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreParameters, self).__init__(**kwargs) - self.time_to_restore = kwargs['time_to_restore'] - self.blob_ranges = kwargs['blob_ranges'] - - -class BlobRestoreRange(msrest.serialization.Model): - """Blob range. - - All required parameters must be populated in order to send to Azure. - - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str - """ - - _validation = { - 'start_range': {'required': True}, - 'end_range': {'required': True}, - } - - _attribute_map = { - 'start_range': {'key': 'startRange', 'type': 'str'}, - 'end_range': {'key': 'endRange', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreRange, self).__init__(**kwargs) - self.start_range = kwargs['start_range'] - self.end_range = kwargs['end_range'] - - -class BlobRestoreStatus(msrest.serialization.Model): - """Blob restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates - that blob restore is ongoing. - Complete: Indicates that blob restore has been completed - successfully. - Failed: Indicates that blob restore is failed. Possible values include: - "InProgress", "Complete", "Failed". - :vartype status: str or ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreProgressStatus - :ivar failure_reason: Failure reason when blob restore is failed. - :vartype failure_reason: str - :ivar restore_id: Id for tracking blob restore request. - :vartype restore_id: str - :ivar parameters: Blob restore request parameters. - :vartype parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters - """ - - _validation = { - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'restore_id': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - 'restore_id': {'key': 'restoreId', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreStatus, self).__init__(**kwargs) - self.status = None - self.failure_reason = None - self.restore_id = None - self.parameters = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2019_06_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2019_06_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: - ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: - ~azure.mgmt.storage.v2019_06_01.models.LastAccessTimeTrackingPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, - 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.is_versioning_enabled = kwargs.get('is_versioning_enabled', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - self.restore_policy = kwargs.get('restore_policy', None) - self.container_delete_retention_policy = kwargs.get('container_delete_retention_policy', None) - self.last_access_time_tracking_policy = kwargs.get('last_access_time_tracking_policy', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value - is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite - retention of the change feed. - :type retention_in_days: int - """ - - _validation = { - 'retention_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.retention_in_days = kwargs.get('retention_in_days', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2019_06_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2019_06_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2019_06_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2019_06_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - - :param days_after_modification_greater_than: Value indicating the age in days after last - modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last - blob access. This property can only be used in conjunction with last access time tracking - policy. - :type days_after_last_access_time_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, - 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) - self.days_after_last_access_time_greater_than = kwargs.get('days_after_last_access_time_greater_than', None) - - -class DeletedShare(msrest.serialization.Model): - """The deleted share to be restored. - - All required parameters must be populated in order to send to Azure. - - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will - be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str - """ - - _validation = { - 'deleted_share_name': {'required': True}, - 'deleted_share_version': {'required': True}, - } - - _attribute_map = { - 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, - 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedShare, self).__init__(**kwargs) - self.deleted_share_name = kwargs['deleted_share_name'] - self.deleted_share_version = kwargs['deleted_share_version'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2019_06_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2019_06_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2019_06_01.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionScope(Resource): - """The Encryption Scope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): - Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", - "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, - Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeState - :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modification date and time of the encryption scope in - UTC. - :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a - required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: - ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeKeyVaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScope, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.state = kwargs.get('state', None) - self.creation_time = None - self.last_modified_time = None - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): - """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - - :param key_uri: The object identifier for a key vault key object. When applied, the encryption - scope will use the key referenced by the identifier to enable customer-managed key support on - this encryption scope. - :type key_uri: str - """ - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - - -class EncryptionScopeListResult(msrest.serialization.Model): - """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of encryption scopes requested. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.EncryptionScope] - :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned - when total number of requested encryption scopes exceeds the maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type - implies that an account-scoped encryption key will be used. 'Service' key type implies that a - default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2019_06_01.models.KeyType - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - self.key_type = kwargs.get('key_type', None) - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = kwargs.get('table', None) - self.queue = kwargs.get('queue', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: - ~azure.mgmt.storage.v2019_06_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: - ~azure.mgmt.storage.v2019_06_01.models.StorageAccountInternetEndpoints - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, - 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - self.microsoft_endpoints = kwargs.get('microsoft_endpoints', None) - self.internet_endpoints = kwargs.get('internet_endpoints', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the storage resource provider. - - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2019_06_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body contract. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: - ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.share_delete_retention_policy = kwargs.get('share_delete_retention_policy', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2019_06_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2019_06_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class LastAccessTimeTrackingPolicy(msrest.serialization.Model): - """The blob service properties for Last access time based tracking policy. - - All required parameters must be populated in order to send to Azure. - - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently - read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2019_06_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in - days, typically how often the blob object should be tracked.This field is currently read only - with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported - value. This field is currently read only. - :type blob_type: list[str] - """ - - _validation = { - 'enable': {'required': True}, - } - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, - 'blob_type': {'key': 'blobType', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) - self.enable = kwargs['enable'] - self.name = kwargs.get('name', None) - self.tracking_granularity_in_days = kwargs.get('tracking_granularity_in_days', None) - self.blob_type = kwargs.get('blob_type', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2019_06_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListBlobInventoryPolicy(msrest.serialization.Model): - """List of blob inventory policies returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob inventory policies. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListBlobInventoryPolicy, self).__init__(**kwargs) - self.value = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2019_06_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueue(Resource): - """ListQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - - -class ListQueueResource(msrest.serialization.Model): - """Response schema. Contains list of queues returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queues returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.ListQueue] - :ivar next_link: Request URL that can be used to list next page of queues. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueueServices(msrest.serialization.Model): - """ListQueueServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queue services returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.QueueServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueServices, self).__init__(**kwargs) - self.value = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ListTableResource(msrest.serialization.Model): - """Response schema. Contains list of tables returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of tables returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.Table] - :ivar next_link: Request URL that can be used to query next page of tables. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Table]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListTableServices(msrest.serialization.Model): - """ListTableServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of table services returned. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.TableServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableServices, self).__init__(**kwargs) - self.value = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyVersion - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - self.version = kwargs.get('version', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - self.enable_auto_tier_to_hot_from_cool = kwargs.get('enable_auto_tier_to_hot_from_cool', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports - all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag - filters. - :type blob_index_match: list[~azure.mgmt.storage.v2019_06_01.models.TagFilter] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.blob_index_match = kwargs.get('blob_index_match', None) - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2019_06_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyVersion(msrest.serialization.Model): - """Management policy action for blob version. - - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob - version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyVersion, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2019_06_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2019_06_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2019_06_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2019_06_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2019_06_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class ObjectReplicationPolicies(msrest.serialization.Model): - """List storage account object replication policies. - - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicies, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ObjectReplicationPolicy(Resource): - """The replication policy between two storage accounts. Multiple rules can be defined in one policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar policy_id: A unique id for object replication policy. - :vartype policy_id: str - :ivar enabled_time: Indicates when the policy is enabled on the source account. - :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, - 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, - 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicy, self).__init__(**kwargs) - self.policy_id = None - self.enabled_time = None - self.source_account = kwargs.get('source_account', None) - self.destination_account = kwargs.get('destination_account', None) - self.rules = kwargs.get('rules', None) - - -class ObjectReplicationPolicyFilter(msrest.serialization.Model): - """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin - with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.min_creation_time = kwargs.get('min_creation_time', None) - - -class ObjectReplicationPolicyRule(msrest.serialization.Model): - """The replication policy rule between two containers. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is - required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter - """ - - _validation = { - 'source_container': {'required': True}, - 'destination_container': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'source_container': {'key': 'sourceContainer', 'type': 'str'}, - 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyRule, self).__init__(**kwargs) - self.rule_id = kwargs.get('rule_id', None) - self.source_container = kwargs['source_container'] - self.destination_container = kwargs['destination_container'] - self.filters = kwargs.get('filters', None) - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2019_06_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2019_06_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :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(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storage.v2019_06_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type action_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class QueueServiceProperties(Resource): - """The properties of a storage account’s Queue service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(QueueServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class RestorePolicyProperties(msrest.serialization.Model): - """The blob service properties for blob restore policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than - DeleteRetentionPolicy.days. - :type days: int - :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. - :vartype last_enabled_time: ~datetime.datetime - :ivar min_restore_time: Returns the minimum date and time that the restore can be started. - :vartype min_restore_time: ~datetime.datetime - """ - - _validation = { - 'enabled': {'required': True}, - 'days': {'maximum': 365, 'minimum': 1}, - 'last_enabled_time': {'readonly': True}, - 'min_restore_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePolicyProperties, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs.get('days', None) - self.last_enabled_time = None - self.min_restore_time = None - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2019_06_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class RoutingPreference(msrest.serialization.Model): - """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. - Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2019_06_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing - storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing - storage endpoints are to be published. - :type publish_internet_endpoints: bool - """ - - _attribute_map = { - 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, - 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, - 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingPreference, self).__init__(**kwargs) - self.routing_choice = kwargs.get('routing_choice', None) - self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) - self.publish_internet_endpoints = kwargs.get('publish_internet_endpoints', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2019_06_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2019_06_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuInformation(msrest.serialization.Model): - """Storage SKU and its 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. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2019_06_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2019_06_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2019_06_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_06_01.models.Identity - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2019_06_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2019_06_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2019_06_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2019_06_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2019_06_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2019_06_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage account. - :vartype private_endpoint_connections: - list[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference - :ivar blob_restore_status: Blob restore status. - :vartype blob_restore_status: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'blob_restore_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.private_endpoint_connections = None - self.routing_preference = kwargs.get('routing_preference', None) - self.blob_restore_status = None - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_06_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageAccountInternetEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountInternetEndpoints, self).__init__(**kwargs) - self.blob = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2019_06_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2019_06_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_06_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageQueue(Resource): - """StorageQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - :ivar approximate_message_count: Integer indicating an approximate number of messages in the - queue. This number is not lower than the actual number of messages in the queue, but could be - higher. - :vartype approximate_message_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'approximate_message_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - self.approximate_message_count = None - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.SkuInformation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2019_06_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2019_06_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Table(Resource): - """Properties of the table, including Id, resource name, resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar table_name: Table name under the specified account. - :vartype table_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'table_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Table, self).__init__(**kwargs) - self.table_name = None - - -class TableServiceProperties(Resource): - """The properties of a storage account’s Table service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(TableServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class TagFilter(msrest.serialization.Model): - """Blob index tag based filtering for blob objects. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and - filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can - have 0 - 256 characters. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 128, 'min_length': 1}, - 'op': {'required': True}, - 'value': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'op': {'key': 'op', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagFilter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.op = kwargs['op'] - self.value = kwargs['value'] - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2019_06_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2019_06_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2019_06_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py index 8511407eeb5f..fb1f9171b4c8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py @@ -20,31 +20,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2019_06_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2019_06_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -78,6 +78,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2019_06_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -94,19 +122,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -138,6 +166,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -178,6 +222,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -219,6 +265,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -228,12 +276,12 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2019_06_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2019_06_01.models.ActiveDirectoryProperties """ @@ -253,6 +301,15 @@ def __init__( active_directory_properties: Optional["ActiveDirectoryProperties"] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2019_06_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2019_06_01.models.ActiveDirectoryProperties + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -281,15 +338,15 @@ class BlobContainer(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -301,8 +358,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyProperties @@ -370,6 +427,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.version = None self.deleted = None @@ -406,9 +476,8 @@ class BlobInventoryPolicy(Resource): :vartype system_data: ~azure.mgmt.storage.v2019_06_01.models.SystemData :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicySchema + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicySchema """ _validation = { @@ -434,6 +503,11 @@ def __init__( policy: Optional["BlobInventoryPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicySchema + """ super(BlobInventoryPolicy, self).__init__(**kwargs) self.system_data = None self.last_modified_time = None @@ -445,8 +519,8 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyFilter + :ivar filters: Required. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyFilter """ _validation = { @@ -463,6 +537,10 @@ def __init__( filters: "BlobInventoryPolicyFilter", **kwargs ): + """ + :keyword filters: Required. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyFilter + """ super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) self.filters = filters @@ -472,15 +550,15 @@ class BlobInventoryPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value set to true. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :vartype include_snapshots: bool """ _validation = { @@ -503,6 +581,18 @@ def __init__( include_snapshots: Optional[bool] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Valid values include + blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value set to + true. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :paramtype include_snapshots: bool + """ super(BlobInventoryPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -515,13 +605,13 @@ class BlobInventoryPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyDefinition + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyDefinition """ _validation = { @@ -544,6 +634,15 @@ def __init__( definition: "BlobInventoryPolicyDefinition", **kwargs ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyDefinition + """ super(BlobInventoryPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -555,16 +654,16 @@ class BlobInventoryPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar destination: Required. Container name where blob inventory files are stored. Must be pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2019_06_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied + :vartype destination: str + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2019_06_01.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied when it is enabled. - :type rules: list[~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyRule] """ _validation = { @@ -590,6 +689,18 @@ def __init__( rules: List["BlobInventoryPolicyRule"], **kwargs ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2019_06_01.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyRule] + """ super(BlobInventoryPolicySchema, self).__init__(**kwargs) self.enabled = enabled self.destination = destination @@ -602,10 +713,10 @@ class BlobRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] """ _validation = { @@ -625,6 +736,12 @@ def __init__( blob_ranges: List["BlobRestoreRange"], **kwargs ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] + """ super(BlobRestoreParameters, self).__init__(**kwargs) self.time_to_restore = time_to_restore self.blob_ranges = blob_ranges @@ -635,10 +752,10 @@ class BlobRestoreRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str """ _validation = { @@ -658,6 +775,12 @@ def __init__( end_range: str, **kwargs ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ super(BlobRestoreRange, self).__init__(**kwargs) self.start_range = start_range self.end_range = end_range @@ -699,6 +822,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -727,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -746,31 +873,30 @@ class BlobServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2019_06_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2019_06_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2019_06_01.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2019_06_01.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: ~azure.mgmt.storage.v2019_06_01.models.LastAccessTimeTrackingPolicy """ @@ -811,6 +937,36 @@ def __init__( last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2019_06_01.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: ~azure.mgmt.storage.v2019_06_01.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2019_06_01.models.LastAccessTimeTrackingPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -827,12 +983,12 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - :type retention_in_days: int + :vartype retention_in_days: int """ _validation = { @@ -851,6 +1007,14 @@ def __init__( retention_in_days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled self.retention_in_days = retention_in_days @@ -889,6 +1053,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -898,17 +1064,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2019_06_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2019_06_01.models.CloudErrorBody] """ _attribute_map = { @@ -927,6 +1093,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2019_06_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -939,22 +1118,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2019_06_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -983,6 +1162,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2019_06_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -994,9 +1191,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2019_06_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2019_06_01.models.CorsRule] """ _attribute_map = { @@ -1009,6 +1206,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2019_06_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -1018,12 +1220,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -1042,6 +1244,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -1052,9 +1262,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -1071,6 +1281,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -1078,13 +1293,13 @@ def __init__( class DateAfterModification(msrest.serialization.Model): """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - :param days_after_modification_greater_than: Value indicating the age in days after last + :ivar days_after_modification_greater_than: Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy. - :type days_after_last_access_time_greater_than: float + :vartype days_after_last_access_time_greater_than: float """ _validation = { @@ -1104,6 +1319,15 @@ def __init__( days_after_last_access_time_greater_than: Optional[float] = None, **kwargs ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than @@ -1114,12 +1338,12 @@ class DeletedShare(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str """ _validation = { @@ -1139,6 +1363,14 @@ def __init__( deleted_share_version: str, **kwargs ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ super(DeletedShare, self).__init__(**kwargs) self.deleted_share_name = deleted_share_name self.deleted_share_version = deleted_share_version @@ -1147,11 +1379,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -1170,6 +1402,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1178,10 +1417,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1196,6 +1435,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1206,17 +1451,17 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2019_06_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2019_06_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2019_06_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :vartype key_source: str or ~azure.mgmt.storage.v2019_06_01.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2019_06_01.models.KeyVaultProperties + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2019_06_01.models.KeyVaultProperties """ _validation = { @@ -1239,6 +1484,19 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2019_06_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2019_06_01.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2019_06_01.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -1259,21 +1517,21 @@ class EncryptionScope(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + :vartype source: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeState + :vartype state: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeState :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. :vartype creation_time: ~datetime.datetime :ivar last_modified_time: Gets the last modification date and time of the encryption scope in UTC. :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: + :vartype key_vault_properties: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeKeyVaultProperties """ @@ -1304,6 +1562,19 @@ def __init__( key_vault_properties: Optional["EncryptionScopeKeyVaultProperties"] = None, **kwargs ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeKeyVaultProperties + """ super(EncryptionScope, self).__init__(**kwargs) self.source = source self.state = state @@ -1315,10 +1586,10 @@ def __init__( class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :param key_uri: The object identifier for a key vault key object. When applied, the encryption + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - :type key_uri: str + :vartype key_uri: str """ _attribute_map = { @@ -1331,6 +1602,12 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri @@ -1361,6 +1638,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1371,17 +1650,17 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2019_06_01.models.KeyType + :vartype key_type: str or ~azure.mgmt.storage.v2019_06_01.models.KeyType """ _validation = { @@ -1401,6 +1680,15 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2019_06_01.models.KeyType + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -1410,14 +1698,14 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService """ _attribute_map = { @@ -1436,6 +1724,16 @@ def __init__( queue: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2019_06_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -1460,11 +1758,11 @@ class Endpoints(msrest.serialization.Model): :vartype web: str :ivar dfs: Gets the dfs endpoint. :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountInternetEndpoints """ @@ -1495,6 +1793,14 @@ def __init__( internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, **kwargs ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2019_06_01.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2019_06_01.models.StorageAccountInternetEndpoints + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -1509,8 +1815,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the storage resource provider. - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2019_06_01.models.ErrorResponseBody + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2019_06_01.models.ErrorResponseBody """ _attribute_map = { @@ -1523,6 +1829,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2019_06_01.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1530,12 +1840,12 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body contract. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1550,6 +1860,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1576,6 +1894,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1595,12 +1915,12 @@ class FileServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: + :vartype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy """ @@ -1627,6 +1947,15 @@ def __init__( share_delete_retention_policy: Optional["DeleteRetentionPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2019_06_01.models.DeleteRetentionPolicy + """ super(FileServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -1650,17 +1979,17 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1669,10 +1998,10 @@ class FileShare(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -1728,6 +2057,23 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1761,17 +2107,17 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1780,10 +2126,10 @@ class FileShareItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -1839,6 +2185,23 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1881,6 +2244,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1924,6 +2289,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -1963,6 +2330,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1983,18 +2352,18 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2022,6 +2391,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -2037,18 +2417,18 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2019_06_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2072,6 +2452,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -2085,12 +2476,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -2109,6 +2500,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -2119,12 +2518,12 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -2153,6 +2552,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2166,18 +2573,18 @@ class LastAccessTimeTrackingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2019_06_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in + :vartype name: str or ~azure.mgmt.storage.v2019_06_01.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only. - :type blob_type: list[str] + :vartype blob_type: list[str] """ _validation = { @@ -2200,6 +2607,20 @@ def __init__( blob_type: Optional[List[str]] = None, **kwargs ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2019_06_01.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) self.enable = enable self.name = name @@ -2212,20 +2633,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2250,6 +2671,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2261,11 +2698,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2280,6 +2717,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2297,9 +2741,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -2318,6 +2762,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2333,8 +2782,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2019_06_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2019_06_01.models.TagProperty] """ _validation = { @@ -2352,6 +2801,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2019_06_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2378,6 +2831,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2403,6 +2858,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2430,15 +2887,15 @@ class ListContainerItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -2450,8 +2907,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicyProperties @@ -2519,6 +2976,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2019_06_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.version = None self.deleted = None @@ -2564,6 +3034,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2582,8 +3054,8 @@ class ListQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] """ _validation = { @@ -2605,6 +3077,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = metadata @@ -2634,6 +3110,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2660,6 +3138,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2685,6 +3165,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2714,6 +3196,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2740,6 +3224,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2759,9 +3245,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySchema """ _validation = { @@ -2785,6 +3271,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -2793,12 +3284,12 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyVersion + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyVersion """ _attribute_map = { @@ -2815,6 +3306,14 @@ def __init__( version: Optional["ManagementPolicyVersion"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyVersion + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -2824,18 +3323,17 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool + :vartype tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool """ _attribute_map = { @@ -2854,6 +3352,20 @@ def __init__( enable_auto_tier_to_hot_from_cool: Optional[bool] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -2866,10 +3378,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyFilter """ _validation = { @@ -2888,6 +3400,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -2898,14 +3416,14 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag filters. - :type blob_index_match: list[~azure.mgmt.storage.v2019_06_01.models.TagFilter] + :vartype blob_index_match: list[~azure.mgmt.storage.v2019_06_01.models.TagFilter] """ _validation = { @@ -2926,6 +3444,16 @@ def __init__( blob_index_match: Optional[List["TagFilter"]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2019_06_01.models.TagFilter] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -2937,15 +3465,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2019_06_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2019_06_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyDefinition """ _validation = { @@ -2970,6 +3498,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2019_06_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -2982,9 +3521,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyRule] """ _validation = { @@ -3001,6 +3540,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -3008,14 +3552,14 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation """ _attribute_map = { @@ -3032,6 +3576,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3041,14 +3595,14 @@ def __init__( class ManagementPolicyVersion(msrest.serialization.Model): """Management policy action for blob version. - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation """ _attribute_map = { @@ -3065,6 +3619,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2019_06_01.models.DateAfterCreation + """ super(ManagementPolicyVersion, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3074,24 +3638,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2019_06_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2019_06_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -3120,6 +3684,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2019_06_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3137,18 +3721,18 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2019_06_01.models.Bypass - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2019_06_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2019_06_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2019_06_01.models.Bypass + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2019_06_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2019_06_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2019_06_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2019_06_01.models.DefaultAction """ _validation = { @@ -3171,6 +3755,21 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2019_06_01.models.Bypass + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2019_06_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2019_06_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2019_06_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.virtual_network_rules = virtual_network_rules @@ -3181,8 +3780,8 @@ def __init__( class ObjectReplicationPolicies(msrest.serialization.Model): """List storage account object replication policies. - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy] + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy] """ _attribute_map = { @@ -3195,6 +3794,10 @@ def __init__( value: Optional[List["ObjectReplicationPolicy"]] = None, **kwargs ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy] + """ super(ObjectReplicationPolicies, self).__init__(**kwargs) self.value = value @@ -3216,12 +3819,12 @@ class ObjectReplicationPolicy(Resource): :vartype policy_id: str :ivar enabled_time: Indicates when the policy is enabled on the source account. :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] + :ivar source_account: Required. Source account name. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] """ _validation = { @@ -3251,6 +3854,14 @@ def __init__( rules: Optional[List["ObjectReplicationPolicyRule"]] = None, **kwargs ): + """ + :keyword source_account: Required. Source account name. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] + """ super(ObjectReplicationPolicy, self).__init__(**kwargs) self.policy_id = None self.enabled_time = None @@ -3262,12 +3873,12 @@ def __init__( class ObjectReplicationPolicyFilter(msrest.serialization.Model): """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str """ _attribute_map = { @@ -3282,6 +3893,14 @@ def __init__( min_creation_time: Optional[str] = None, **kwargs ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.min_creation_time = min_creation_time @@ -3292,15 +3911,15 @@ class ObjectReplicationPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter """ _validation = { @@ -3324,6 +3943,17 @@ def __init__( filters: Optional["ObjectReplicationPolicyFilter"] = None, **kwargs ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter + """ super(ObjectReplicationPolicyRule, self).__init__(**kwargs) self.rule_id = rule_id self.source_container = source_container @@ -3334,14 +3964,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2019_06_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2019_06_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2019_06_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2019_06_01.models.ServiceSpecification """ _attribute_map = { @@ -3360,6 +3990,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2019_06_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2019_06_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3370,14 +4010,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -3396,6 +4036,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3406,8 +4056,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.Operation] """ _attribute_map = { @@ -3420,6 +4070,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2019_06_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -3445,6 +4099,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3462,11 +4118,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storage.v2019_06_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -3497,6 +4153,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2019_06_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -3506,8 +4170,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection] """ _attribute_map = { @@ -3520,6 +4184,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -3541,8 +4209,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -3568,6 +4236,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -3577,8 +4249,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateLinkResource] """ _attribute_map = { @@ -3591,6 +4263,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2019_06_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -3598,15 +4274,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -3623,6 +4299,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -3642,10 +4329,10 @@ class QueueServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules """ _validation = { @@ -3667,6 +4354,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + """ super(QueueServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -3678,11 +4371,11 @@ class RestorePolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than + :ivar enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - :type days: int + :vartype days: int :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. :vartype last_enabled_time: ~datetime.datetime :ivar min_restore_time: Returns the minimum date and time that the restore can be started. @@ -3710,6 +4403,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -3727,11 +4427,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2019_06_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2019_06_01.models.ReasonCode """ _validation = { @@ -3751,6 +4451,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2019_06_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -3760,15 +4467,15 @@ def __init__( class RoutingPreference(msrest.serialization.Model): """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2019_06_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + :vartype routing_choice: str or ~azure.mgmt.storage.v2019_06_01.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing storage endpoints are to be published. - :type publish_internet_endpoints: bool + :vartype publish_internet_endpoints: bool """ _attribute_map = { @@ -3785,6 +4492,17 @@ def __init__( publish_internet_endpoints: Optional[bool] = None, **kwargs ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2019_06_01.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ super(RoutingPreference, self).__init__(**kwargs) self.routing_choice = routing_choice self.publish_microsoft_endpoints = publish_microsoft_endpoints @@ -3796,49 +4514,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -3890,6 +4607,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2019_06_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2019_06_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2019_06_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -3914,8 +4677,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2019_06_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2019_06_01.models.MetricSpecification] """ _attribute_map = { @@ -3928,6 +4692,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2019_06_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -3939,11 +4708,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2019_06_01.models.SkuTier @@ -3965,6 +4734,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -3996,6 +4772,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4008,11 +4786,11 @@ class SkuInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2019_06_01.models.SkuTier @@ -4027,9 +4805,9 @@ class SkuInformation(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2019_06_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2019_06_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2019_06_01.models.Restriction] """ _validation = { @@ -4058,6 +4836,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2019_06_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2019_06_01.models.Restriction] + """ super(SkuInformation, self).__init__(**kwargs) self.name = name self.tier = None @@ -4083,10 +4871,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -4111,6 +4899,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -4131,17 +4925,17 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_06_01.models.Identity + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2019_06_01.models.Identity :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2019_06_01.models.ProvisioningState @@ -4180,46 +4974,46 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2019_06_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState :ivar private_endpoint_connections: List of private endpoint connection associated with the specified storage account. :vartype private_endpoint_connections: list[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :vartype routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference :ivar blob_restore_status: Blob restore status. :vartype blob_restore_status: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _validation = { @@ -4300,6 +5094,42 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2019_06_01.models.Identity + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -4338,8 +5168,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -4363,6 +5193,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -4372,63 +5206,63 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype location: str + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_06_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2019_06_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _validation = { @@ -4479,6 +5313,65 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2019_06_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -4532,6 +5425,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4569,6 +5464,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4597,6 +5494,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4627,6 +5526,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4673,6 +5574,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -4687,9 +5590,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -4706,6 +5609,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -4713,58 +5621,57 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2019_06_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2019_06_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2019_06_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _attribute_map = { @@ -4805,6 +5712,61 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2019_06_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2019_06_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2019_06_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2019_06_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2019_06_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2019_06_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2019_06_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2019_06_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2019_06_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -4836,8 +5798,8 @@ class StorageQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] :ivar approximate_message_count: Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. @@ -4865,6 +5827,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = metadata self.approximate_message_count = None @@ -4891,6 +5857,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -4898,20 +5866,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2019_06_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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.storage.v2019_06_01.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". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2019_06_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.storage.v2019_06_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4934,6 +5902,22 @@ def __init__( 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.storage.v2019_06_01.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.storage.v2019_06_01.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 @@ -4978,6 +5962,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -4995,10 +5981,10 @@ class TableServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules """ _validation = { @@ -5020,6 +6006,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2019_06_01.models.CorsRules + """ super(TableServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -5029,14 +6021,14 @@ class TagFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters. - :type value: str + :vartype value: str """ _validation = { @@ -5059,6 +6051,16 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ super(TagFilter, self).__init__(**kwargs) self.name = name self.op = op @@ -5102,6 +6104,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5154,6 +6158,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5197,6 +6203,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5207,8 +6215,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2019_06_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2019_06_01.models.Usage] """ _attribute_map = { @@ -5221,6 +6229,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2019_06_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -5250,6 +6262,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5260,15 +6274,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2019_06_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2019_06_01.models.State """ _validation = { @@ -5289,6 +6303,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2019_06_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py index 7b7c5cc8ba74..c2f69ac92c11 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,11 +26,11 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class BlobInventoryPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. @@ -55,7 +40,7 @@ class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En COMPLETE = "Complete" FAILED = "Failed" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -66,7 +51,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -76,7 +61,7 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -85,14 +70,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -100,7 +85,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication protocol that is used for the file share. Can only be specified when creating a share. """ @@ -108,7 +93,7 @@ class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SMB = "SMB" NFS = "NFS" -class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. """ @@ -116,14 +101,14 @@ class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class EncryptionScopeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -135,21 +120,21 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -158,20 +143,20 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class InventoryRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Inventory """ INVENTORY = "Inventory" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -179,7 +164,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. @@ -188,7 +173,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE = "Service" ACCOUNT = "Account" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -198,14 +183,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -215,7 +200,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -223,7 +208,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -233,22 +218,22 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ListContainersInclude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -257,13 +242,13 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only """ ACCESS_TIME_TRACKING = "AccessTimeTracking" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -277,7 +262,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -286,7 +271,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -294,7 +279,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -302,7 +287,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -310,7 +295,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -318,7 +303,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -328,7 +313,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The property is for NFS share only. The default is NoRootSquash. """ @@ -336,20 +321,20 @@ class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class RoutingChoice(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Routing Choice defines the kind of network routing opted by the user. """ MICROSOFT_ROUTING = "MicrosoftRouting" INTERNET_ROUTING = "InternetRouting" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -359,7 +344,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. """ @@ -369,7 +354,7 @@ class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" PREMIUM = "Premium" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -379,7 +364,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -389,7 +374,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -403,14 +388,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -420,12 +405,12 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class StorageAccountExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO_REPLICATION_STATS = "geoReplicationStats" BLOB_RESTORE_STATUS = "blobRestoreStatus" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py index b3c9ed30ebf4..440e92e8d075 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py @@ -5,23 +5,593 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,16 +615,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - include=None, # type: Optional[Union[str, "_models.ListContainersInclude"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -83,42 +653,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,20 +703,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -178,33 +746,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,17 +780,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -260,33 +820,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,16 +850,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -334,28 +886,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +911,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -403,26 +947,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,15 +971,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -472,33 +1009,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,17 +1039,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -550,33 +1079,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -590,18 +1109,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -634,40 +1155,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,23 +1185,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -723,32 +1234,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,23 +1256,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the @@ -806,31 +1307,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -840,23 +1329,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -886,29 +1378,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -918,24 +1400,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -969,37 +1454,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1009,23 +1484,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1053,36 +1531,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,4 +1564,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py index 5fbbd9e6aa02..58a6cc216347 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +222,8 @@ def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy @@ -75,34 +234,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -111,17 +260,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - properties, # type: "_models.BlobInventoryPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Sets the blob inventory policy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -133,7 +284,8 @@ def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -146,39 +298,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -187,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: """Deletes the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -208,7 +352,8 @@ def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicyName :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 @@ -219,34 +364,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -254,13 +389,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListBlobInventoryPolicy"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -271,8 +407,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -280,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -322,12 +457,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py index d877f294e3ef..55da7fe4a9af 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -71,36 +192,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +236,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +273,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +302,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +333,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +357,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py index 3b7bb4057af5..60c9a4868caf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py @@ -5,23 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,15 +212,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. @@ -82,39 +249,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -127,17 +284,19 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. @@ -165,39 +324,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -206,16 +355,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": """Returns the properties for the specified encryption scope. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -240,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -276,15 +417,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionScopeListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: """Lists all the encryption scopes available under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -295,8 +438,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -304,36 +449,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,6 +493,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py index 8e0b085edb96..eeafad79cf00 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py index 53ae17a491f1..2493f1461b83 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py @@ -5,23 +5,287 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = "deleted", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = "stats", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +309,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - expand="deleted", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = "deleted", + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,7 +334,8 @@ def list( :param filter: Optional. When specified, only share names starting with the filter will be listed. :type filter: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "deleted". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) @@ -82,42 +347,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,20 +397,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -177,33 +440,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -221,17 +474,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -259,33 +514,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,17 +544,19 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - expand="stats", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = "stats", + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -324,7 +571,8 @@ def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FileShare, or the result of cls(response) @@ -336,30 +584,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,16 +610,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -407,28 +646,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,15 +670,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def restore( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - deleted_share, # type: "_models.DeletedShare" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: """Restore a file share within a valid retention days if share soft delete is enabled. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -476,33 +706,23 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,3 +734,4 @@ def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py index cd321d246190..2e15ad454755 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py index 28b09ddec825..09261be51d10 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ObjectReplicationPolicies"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: """List the object replication policies associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Get the object replication policy of the storage account by policy ID. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -154,34 +312,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -190,17 +338,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - properties, # type: "_models.ObjectReplicationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Create or update the object replication policy of the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -226,39 +376,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -267,16 +407,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: """Deletes the object replication policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -299,37 +441,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py index a96d3bf80d89..bfe27977e36c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2019_06_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py index 24001491246c..2c46eeaede6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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 = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,17 +337,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -224,39 +374,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -265,16 +405,18 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -297,37 +439,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py index d733e262c4b1..08cb1c91fb33 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +107,17 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +131,6 @@ def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py index d6bb802dafd7..06016f02ba58 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): """QueueOperations operations. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -80,33 +291,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +321,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -157,33 +360,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,16 +390,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": """Gets the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -231,28 +426,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -266,16 +451,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -300,28 +487,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -334,15 +511,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListQueueResource"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: """Gets a list of all the queues under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -368,40 +546,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +594,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py index a7297a1c3f91..96ad80a92a84 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListQueueServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": """List all queue services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.QueueServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py index 7f5287836659..7b8323daab5b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py index 543c0d4ae407..470e1de69480 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py @@ -5,25 +5,561 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +583,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult @@ -69,30 +606,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +633,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +680,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +708,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +732,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +758,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +787,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +810,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -332,29 +844,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +869,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -406,32 +909,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,19 +938,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -465,34 +962,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +1002,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -528,8 +1021,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2019_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -537,35 +1032,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -583,19 +1074,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -606,7 +1098,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -618,29 +1111,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,16 +1136,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -675,7 +1159,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2019_06_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult @@ -686,32 +1171,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,16 +1200,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -756,32 +1233,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,16 +1262,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -826,32 +1295,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,39 +1324,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2019-06-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,13 +1362,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -930,15 +1383,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -952,21 +1407,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -978,47 +1426,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore def _restore_blob_ranges_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobRestoreStatus" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,16 +1474,18 @@ def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace def begin_restore_blob_ranges( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BlobRestoreStatus"] + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: """Restore blobs in the specified blob ranges. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1059,15 +1499,19 @@ def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) + :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 BlobRestoreStatus or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1079,27 +1523,21 @@ def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1111,15 +1549,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1139,25 +1578,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1169,3 +1600,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py index 155d0c785102..5e3467eb25e5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): """TableOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -76,28 +261,18 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,16 +286,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -144,28 +321,18 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,16 +346,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Gets the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -212,28 +381,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,16 +406,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -280,28 +441,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -314,13 +465,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListTableResource"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: """Gets a list of all the tables under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -340,36 +492,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -387,6 +536,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py index 6ef68d0babf6..4f70389ac953 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): """TableServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListTableServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": """List all table services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.TableServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": """Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": """Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py index 6e6699a9122d..1d5110749d9c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py index e095a674c8a6..a996f0cfc927 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json index ac3378620930..c97e860595d1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py index f6ebf3b7296a..351ca8b78cd5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py @@ -6,42 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -49,121 +29,122 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2020_08_01_preview.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2020_08_01_preview.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2020_08_01_preview.operations.StorageAccountsOperations :ivar deleted_accounts: DeletedAccountsOperations operations - :vartype deleted_accounts: azure.mgmt.storage.v2020_08_01_preview.operations.DeletedAccountsOperations + :vartype deleted_accounts: + azure.mgmt.storage.v2020_08_01_preview.operations.DeletedAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2020_08_01_preview.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2020_08_01_preview.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2020_08_01_preview.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2020_08_01_preview.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2020_08_01_preview.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2020_08_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2020_08_01_preview.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2020_08_01_preview.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2020_08_01_preview.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2020_08_01_preview.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2020_08_01_preview.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2020_08_01_preview.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2020_08_01_preview.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations - :vartype blob_services: azure.mgmt.storage.v2020_08_01_preview.operations.BlobServicesOperations + :vartype blob_services: + azure.mgmt.storage.v2020_08_01_preview.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2020_08_01_preview.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2020_08_01_preview.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations - :vartype file_services: azure.mgmt.storage.v2020_08_01_preview.operations.FileServicesOperations + :vartype file_services: + azure.mgmt.storage.v2020_08_01_preview.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations :vartype file_shares: azure.mgmt.storage.v2020_08_01_preview.operations.FileSharesOperations :ivar queue_services: QueueServicesOperations operations - :vartype queue_services: azure.mgmt.storage.v2020_08_01_preview.operations.QueueServicesOperations + :vartype queue_services: + azure.mgmt.storage.v2020_08_01_preview.operations.QueueServicesOperations :ivar queue: QueueOperations operations :vartype queue: azure.mgmt.storage.v2020_08_01_preview.operations.QueueOperations :ivar table_services: TableServicesOperations operations - :vartype table_services: azure.mgmt.storage.v2020_08_01_preview.operations.TableServicesOperations + :vartype table_services: + azure.mgmt.storage.v2020_08_01_preview.operations.TableServicesOperations :ivar table: TableOperations operations :vartype table: azure.mgmt.storage.v2020_08_01_preview.operations.TableOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py index 9071883d4e24..aa973cb19691 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py index 166e30bd6ae1..91dcd892f59d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py @@ -6,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -47,119 +29,123 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2020_08_01_preview.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2020_08_01_preview.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.StorageAccountsOperations :ivar deleted_accounts: DeletedAccountsOperations operations - :vartype deleted_accounts: azure.mgmt.storage.v2020_08_01_preview.aio.operations.DeletedAccountsOperations + :vartype deleted_accounts: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.DeletedAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2020_08_01_preview.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2020_08_01_preview.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2020_08_01_preview.aio.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2020_08_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2020_08_01_preview.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2020_08_01_preview.aio.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2020_08_01_preview.aio.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations - :vartype blob_services: azure.mgmt.storage.v2020_08_01_preview.aio.operations.BlobServicesOperations + :vartype blob_services: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2020_08_01_preview.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations - :vartype file_services: azure.mgmt.storage.v2020_08_01_preview.aio.operations.FileServicesOperations + :vartype file_services: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations - :vartype file_shares: azure.mgmt.storage.v2020_08_01_preview.aio.operations.FileSharesOperations + :vartype file_shares: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.FileSharesOperations :ivar queue_services: QueueServicesOperations operations - :vartype queue_services: azure.mgmt.storage.v2020_08_01_preview.aio.operations.QueueServicesOperations + :vartype queue_services: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.QueueServicesOperations :ivar queue: QueueOperations operations :vartype queue: azure.mgmt.storage.v2020_08_01_preview.aio.operations.QueueOperations :ivar table_services: TableServicesOperations operations - :vartype table_services: azure.mgmt.storage.v2020_08_01_preview.aio.operations.TableServicesOperations + :vartype table_services: + azure.mgmt.storage.v2020_08_01_preview.aio.operations.TableServicesOperations :ivar table: TableOperations operations :vartype table: azure.mgmt.storage.v2020_08_01_preview.aio.operations.TableOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py index 3fbfd652f9f8..7f6fe519cbca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -172,33 +178,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,8 +212,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -253,33 +252,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,8 +282,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -326,28 +318,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,8 +343,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,26 +379,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,6 +403,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -462,33 +441,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,8 +471,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -539,33 +511,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,8 +541,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -622,40 +587,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,14 +617,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -710,32 +666,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -745,14 +688,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -792,31 +739,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -826,14 +761,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -871,29 +810,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -903,14 +832,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -953,37 +886,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -993,14 +916,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1036,36 +963,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,4 +996,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py index cb52b18812dc..acf37fbc6fc8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -106,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -127,7 +127,8 @@ async def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,39 +141,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -181,8 +172,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,7 +195,8 @@ async def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName :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 @@ -212,34 +207,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -247,6 +232,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -263,8 +250,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -272,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -314,12 +300,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py index a8b50842fc17..7fa3666e2b39 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py index 9ee4432d1747..d3bee9dccaf7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._deleted_accounts_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,17 +100,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace_async async def get( self, deleted_account_name: str, @@ -130,33 +135,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -165,4 +160,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py index 4e3ec3c11bec..c92d04a48c6d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def put( self, resource_group_name: str, @@ -77,39 +83,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -122,8 +118,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -159,39 +158,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -200,8 +189,11 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,34 +225,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -269,8 +251,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -287,8 +272,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -296,36 +283,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -343,6 +327,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py index 58e8391bae1d..801821efe615 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py index e1184cdb8c12..a371d3596c62 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_restore_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list( :type expand: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ListSharesExpand :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -77,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +134,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -162,7 +168,7 @@ async def create( :type share_name: str :param file_share: Properties of the file share to create. :type file_share: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare - :param expand: Optional, used to create a snapshot. + :param expand: Optional, used to create a snapshot. The default value is "snapshots". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FileShare, or the result of cls(response) @@ -174,35 +180,24 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,8 +215,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -257,33 +255,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -297,8 +285,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -322,7 +313,8 @@ async def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. :type x_ms_snapshot: str @@ -336,32 +328,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,8 +355,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -411,30 +394,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -447,6 +419,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def restore( self, resource_group_name: str, @@ -481,33 +455,23 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -519,3 +483,4 @@ async def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py index 7af33facc22d..c584859b67d3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py index a906c358f4fe..b6b5a201e7a9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -148,34 +155,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -184,8 +181,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -219,39 +219,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -260,8 +250,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -291,37 +284,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py index f113b28ee1ef..8eee687fb2f3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py index b965d4e311b2..9dcc1e653717 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -217,39 +217,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -258,8 +248,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -289,37 +282,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py index 5a6ade98542b..8a69188f3650 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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_list_by_storage_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_account( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,4 +94,6 @@ async def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py index d8541e40852e..af7dd1724e9d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -75,33 +81,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +111,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -151,33 +150,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,8 +180,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,28 +216,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,8 +241,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -292,28 +277,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -326,6 +301,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -351,7 +328,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListQueueResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -359,40 +337,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -410,6 +385,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py index 0eb1beeee8e6..fed47babc9fa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueueServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py index 814c41264640..32dd2f5aff5c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py index 38d4184b62d4..75f2220e087d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -323,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -396,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -445,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -516,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -593,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -605,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -661,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListKeysResult @@ -672,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -741,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -810,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -862,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -893,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -912,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -934,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -960,6 +892,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore async def _restore_blob_ranges_initial( @@ -974,32 +907,22 @@ async def _restore_blob_ranges_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,8 +940,11 @@ async def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async async def begin_restore_blob_ranges( self, resource_group_name: str, @@ -1039,15 +965,20 @@ async def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1059,27 +990,21 @@ async def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1091,8 +1016,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -1118,25 +1045,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1148,3 +1067,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py index cbdcab3a72ba..dd16f12af75c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -71,28 +77,18 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +102,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,28 +137,18 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,8 +162,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,28 +197,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +222,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -272,28 +257,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,6 +281,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -323,7 +300,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListTableResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -331,36 +309,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -378,6 +353,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py index f239cb8720cb..5991a1eabd32 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TableServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py index c612906d7006..35889f23efbb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py index b9ad67b9a5f0..7fca93457cc8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py @@ -6,260 +6,133 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobInventoryPolicy - from ._models_py3 import BlobInventoryPolicyDefinition - from ._models_py3 import BlobInventoryPolicyFilter - from ._models_py3 import BlobInventoryPolicyRule - from ._models_py3 import BlobInventoryPolicySchema - from ._models_py3 import BlobRestoreParameters - from ._models_py3 import BlobRestoreRange - from ._models_py3 import BlobRestoreStatus - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import DeletedAccount - from ._models_py3 import DeletedAccountListResult - from ._models_py3 import DeletedShare - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionScope - from ._models_py3 import EncryptionScopeKeyVaultProperties - from ._models_py3 import EncryptionScopeListResult - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import ExtendedLocation - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LastAccessTimeTrackingPolicy - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListBlobInventoryPolicy - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListQueue - from ._models_py3 import ListQueueResource - from ._models_py3 import ListQueueServices - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ListTableResource - from ._models_py3 import ListTableServices - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import ManagementPolicyVersion - from ._models_py3 import MetricSpecification - from ._models_py3 import Multichannel - from ._models_py3 import NetworkRuleSet - from ._models_py3 import ObjectReplicationPolicies - from ._models_py3 import ObjectReplicationPolicy - from ._models_py3 import ObjectReplicationPolicyFilter - from ._models_py3 import ObjectReplicationPolicyRule - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProtocolSettings - from ._models_py3 import ProxyResource - from ._models_py3 import QueueServiceProperties - from ._models_py3 import Resource - from ._models_py3 import ResourceAccessRule - from ._models_py3 import RestorePolicyProperties - from ._models_py3 import Restriction - from ._models_py3 import RoutingPreference - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuInformation - from ._models_py3 import SmbSetting - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountInternetEndpoints - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountMicrosoftEndpoints - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageQueue - from ._models_py3 import StorageSkuListResult - from ._models_py3 import SystemData - from ._models_py3 import Table - from ._models_py3 import TableServiceProperties - from ._models_py3 import TagFilter - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobInventoryPolicy # type: ignore - from ._models import BlobInventoryPolicyDefinition # type: ignore - from ._models import BlobInventoryPolicyFilter # type: ignore - from ._models import BlobInventoryPolicyRule # type: ignore - from ._models import BlobInventoryPolicySchema # type: ignore - from ._models import BlobRestoreParameters # type: ignore - from ._models import BlobRestoreRange # type: ignore - from ._models import BlobRestoreStatus # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import DeletedAccount # type: ignore - from ._models import DeletedAccountListResult # type: ignore - from ._models import DeletedShare # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionScope # type: ignore - from ._models import EncryptionScopeKeyVaultProperties # type: ignore - from ._models import EncryptionScopeListResult # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LastAccessTimeTrackingPolicy # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListBlobInventoryPolicy # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListQueue # type: ignore - from ._models import ListQueueResource # type: ignore - from ._models import ListQueueServices # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ListTableResource # type: ignore - from ._models import ListTableServices # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import ManagementPolicyVersion # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import Multichannel # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import ObjectReplicationPolicies # type: ignore - from ._models import ObjectReplicationPolicy # type: ignore - from ._models import ObjectReplicationPolicyFilter # type: ignore - from ._models import ObjectReplicationPolicyRule # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProtocolSettings # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueueServiceProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceAccessRule # type: ignore - from ._models import RestorePolicyProperties # type: ignore - from ._models import Restriction # type: ignore - from ._models import RoutingPreference # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SmbSetting # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountInternetEndpoints # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountMicrosoftEndpoints # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageQueue # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import Table # type: ignore - from ._models import TableServiceProperties # type: ignore - from ._models import TagFilter # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedAccount +from ._models_py3 import DeletedAccountListResult +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import Multichannel +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProtocolSettings +from ._models_py3 import ProxyResource +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceAccessRule +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import SmbSetting +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models.py deleted file mode 100644 index 194dcd985483..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models.py +++ /dev/null @@ -1,5194 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2020_08_01_preview.models.ActiveDirectoryProperties - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2020_08_01_preview.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobInventoryPolicy(Resource): - """The storage account blob inventory policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.storage.v2020_08_01_preview.models.SystemData - :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. - :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicy, self).__init__(**kwargs) - self.system_data = None - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class BlobInventoryPolicyDefinition(msrest.serialization.Model): - """An object that defines the blob inventory rule. Each definition consists of a set of filters. - - All required parameters must be populated in order to send to Azure. - - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyFilter - """ - - _validation = { - 'filters': {'required': True}, - } - - _attribute_map = { - 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) - self.filters = kwargs['filters'] - - -class BlobInventoryPolicyFilter(msrest.serialization.Model): - """An object that defines the blob inventory rule filter conditions. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, - 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.include_blob_versions = kwargs.get('include_blob_versions', None) - self.include_snapshots = kwargs.get('include_snapshots', None) - - -class BlobInventoryPolicyRule(msrest.serialization.Model): - """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyDefinition - """ - - _validation = { - 'enabled': {'required': True}, - 'name': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.name = kwargs['name'] - self.definition = kwargs['definition'] - - -class BlobInventoryPolicySchema(msrest.serialization.Model): - """The storage account blob inventory policy rules. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be - pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied - when it is enabled. - :type rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyRule] - """ - - _validation = { - 'enabled': {'required': True}, - 'destination': {'required': True}, - 'type': {'required': True}, - 'rules': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicySchema, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.destination = kwargs['destination'] - self.type = kwargs['type'] - self.rules = kwargs['rules'] - - -class BlobRestoreParameters(msrest.serialization.Model): - """Blob restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreRange] - """ - - _validation = { - 'time_to_restore': {'required': True}, - 'blob_ranges': {'required': True}, - } - - _attribute_map = { - 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, - 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreParameters, self).__init__(**kwargs) - self.time_to_restore = kwargs['time_to_restore'] - self.blob_ranges = kwargs['blob_ranges'] - - -class BlobRestoreRange(msrest.serialization.Model): - """Blob range. - - All required parameters must be populated in order to send to Azure. - - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str - """ - - _validation = { - 'start_range': {'required': True}, - 'end_range': {'required': True}, - } - - _attribute_map = { - 'start_range': {'key': 'startRange', 'type': 'str'}, - 'end_range': {'key': 'endRange', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreRange, self).__init__(**kwargs) - self.start_range = kwargs['start_range'] - self.end_range = kwargs['end_range'] - - -class BlobRestoreStatus(msrest.serialization.Model): - """Blob restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates - that blob restore is ongoing. - Complete: Indicates that blob restore has been completed - successfully. - Failed: Indicates that blob restore is failed. Possible values include: - "InProgress", "Complete", "Failed". - :vartype status: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreProgressStatus - :ivar failure_reason: Failure reason when blob restore is failed. - :vartype failure_reason: str - :ivar restore_id: Id for tracking blob restore request. - :vartype restore_id: str - :ivar parameters: Blob restore request parameters. - :vartype parameters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreParameters - """ - - _validation = { - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'restore_id': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - 'restore_id': {'key': 'restoreId', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreStatus, self).__init__(**kwargs) - self.status = None - self.failure_reason = None - self.restore_id = None - self.parameters = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: - ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2020_08_01_preview.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: - ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: - ~azure.mgmt.storage.v2020_08_01_preview.models.LastAccessTimeTrackingPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, - 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.is_versioning_enabled = kwargs.get('is_versioning_enabled', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - self.restore_policy = kwargs.get('restore_policy', None) - self.container_delete_retention_policy = kwargs.get('container_delete_retention_policy', None) - self.last_access_time_tracking_policy = kwargs.get('last_access_time_tracking_policy', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value - is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite - retention of the change feed. - :type retention_in_days: int - """ - - _validation = { - 'retention_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.retention_in_days = kwargs.get('retention_in_days', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2020_08_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - - :param days_after_modification_greater_than: Value indicating the age in days after last - modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last - blob access. This property can only be used in conjunction with last access time tracking - policy. - :type days_after_last_access_time_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, - 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) - self.days_after_last_access_time_greater_than = kwargs.get('days_after_last_access_time_greater_than', None) - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class DeletedAccount(ProxyResource): - """Deleted storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar storage_account_resource_id: Full resource id of the original storage account. - :vartype storage_account_resource_id: str - :ivar location: Location of the deleted account. - :vartype location: str - :ivar restore_reference: Can be used to attempt recovering this deleted account via - PutStorageAccount API. - :vartype restore_reference: str - :ivar creation_time: Creation time of the deleted account. - :vartype creation_time: str - :ivar deletion_time: Deletion time of the deleted account. - :vartype deletion_time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'storage_account_resource_id': {'readonly': True}, - 'location': {'readonly': True}, - 'restore_reference': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'deletion_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'restore_reference': {'key': 'properties.restoreReference', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'deletion_time': {'key': 'properties.deletionTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccount, self).__init__(**kwargs) - self.storage_account_resource_id = None - self.location = None - self.restore_reference = None - self.creation_time = None - self.deletion_time = None - - -class DeletedAccountListResult(msrest.serialization.Model): - """The response from the List Deleted Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of deleted accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccount] - :ivar next_link: Request URL that can be used to query next page of deleted accounts. Returned - when total number of requested deleted accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DeletedShare(msrest.serialization.Model): - """The deleted share to be restored. - - All required parameters must be populated in order to send to Azure. - - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will - be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str - """ - - _validation = { - 'deleted_share_name': {'required': True}, - 'deleted_share_version': {'required': True}, - } - - _attribute_map = { - 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, - 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedShare, self).__init__(**kwargs) - self.deleted_share_name = kwargs['deleted_share_name'] - self.deleted_share_version = kwargs['deleted_share_version'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2020_08_01_preview.models.KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionScope(Resource): - """The Encryption Scope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): - Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", - "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, - Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeState - :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modification date and time of the encryption scope in - UTC. - :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a - required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: - ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeKeyVaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScope, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.state = kwargs.get('state', None) - self.creation_time = None - self.last_modified_time = None - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): - """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - - :param key_uri: The object identifier for a key vault key object. When applied, the encryption - scope will use the key referenced by the identifier to enable customer-managed key support on - this encryption scope. - :type key_uri: str - """ - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - - -class EncryptionScopeListResult(msrest.serialization.Model): - """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of encryption scopes requested. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope] - :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned - when total number of requested encryption scopes exceeds the maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type - implies that an account-scoped encryption key will be used. 'Service' key type implies that a - default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeyType - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - self.key_type = kwargs.get('key_type', None) - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = kwargs.get('table', None) - self.queue = kwargs.get('queue', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: - ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: - ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountInternetEndpoints - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, - 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - self.microsoft_endpoints = kwargs.get('microsoft_endpoints', None) - self.internet_endpoints = kwargs.get('internet_endpoints', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the storage resource provider. - - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2020_08_01_preview.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body contract. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExtendedLocation(msrest.serialization.Model): - """The complex type of the extended location. - - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocationTypes - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: - ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2020_08_01_preview.models.ProtocolSettings - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'protocol_settings': {'key': 'properties.protocolSettings', 'type': 'ProtocolSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.share_delete_retention_policy = kwargs.get('share_delete_retention_policy', None) - self.protocol_settings = kwargs.get('protocol_settings', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.snapshot_time = None - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.snapshot_time = None - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2020_08_01_preview.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Has constant value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: - list[~azure.mgmt.storage.v2020_08_01_preview.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class LastAccessTimeTrackingPolicy(msrest.serialization.Model): - """The blob service properties for Last access time based tracking policy. - - All required parameters must be populated in order to send to Azure. - - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently - read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in - days, typically how often the blob object should be tracked.This field is currently read only - with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported - value. This field is currently read only. - :type blob_type: list[str] - """ - - _validation = { - 'enable': {'required': True}, - } - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, - 'blob_type': {'key': 'blobType', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) - self.enable = kwargs['enable'] - self.name = kwargs.get('name', None) - self.tracking_granularity_in_days = kwargs.get('tracking_granularity_in_days', None) - self.blob_type = kwargs.get('blob_type', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListBlobInventoryPolicy(msrest.serialization.Model): - """List of blob inventory policies returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob inventory policies. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListBlobInventoryPolicy, self).__init__(**kwargs) - self.value = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2020_08_01_preview.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueue(Resource): - """ListQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - - -class ListQueueResource(msrest.serialization.Model): - """Response schema. Contains list of queues returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queues returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.ListQueue] - :ivar next_link: Request URL that can be used to list next page of queues. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueueServices(msrest.serialization.Model): - """ListQueueServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queue services returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.QueueServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueServices, self).__init__(**kwargs) - self.value = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ListTableResource(msrest.serialization.Model): - """Response schema. Contains list of tables returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of tables returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Table] - :ivar next_link: Request URL that can be used to query next page of tables. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Table]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListTableServices(msrest.serialization.Model): - """ListTableServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of table services returned. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.TableServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableServices, self).__init__(**kwargs) - self.value = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyVersion - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - self.version = kwargs.get('version', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - self.enable_auto_tier_to_hot_from_cool = kwargs.get('enable_auto_tier_to_hot_from_cool', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports - all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag - filters. - :type blob_index_match: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagFilter] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.blob_index_match = kwargs.get('blob_index_match', None) - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyVersion(msrest.serialization.Model): - """Management policy action for blob version. - - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob - version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyVersion, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class Multichannel(msrest.serialization.Model): - """Multichannel setting. Applies to Premium FileStorage only. - - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Multichannel, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Bypass - :param resource_access_rules: - :type resource_access_rules: - list[~azure.mgmt.storage.v2020_08_01_preview.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.storage.v2020_08_01_preview.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'resource_access_rules': {'key': 'resourceAccessRules', 'type': '[ResourceAccessRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.resource_access_rules = kwargs.get('resource_access_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class ObjectReplicationPolicies(msrest.serialization.Model): - """List storage account object replication policies. - - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicies, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ObjectReplicationPolicy(Resource): - """The replication policy between two storage accounts. Multiple rules can be defined in one policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar policy_id: A unique id for object replication policy. - :vartype policy_id: str - :ivar enabled_time: Indicates when the policy is enabled on the source account. - :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyRule] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, - 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, - 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicy, self).__init__(**kwargs) - self.policy_id = None - self.enabled_time = None - self.source_account = kwargs.get('source_account', None) - self.destination_account = kwargs.get('destination_account', None) - self.rules = kwargs.get('rules', None) - - -class ObjectReplicationPolicyFilter(msrest.serialization.Model): - """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin - with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.min_creation_time = kwargs.get('min_creation_time', None) - - -class ObjectReplicationPolicyRule(msrest.serialization.Model): - """The replication policy rule between two containers. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is - required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyFilter - """ - - _validation = { - 'source_container': {'required': True}, - 'destination_container': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'source_container': {'key': 'sourceContainer', 'type': 'str'}, - 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyRule, self).__init__(**kwargs) - self.rule_id = kwargs.get('rule_id', None) - self.source_container = kwargs['source_container'] - self.destination_container = kwargs['destination_container'] - self.filters = kwargs.get('filters', None) - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2020_08_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: - ~azure.mgmt.storage.v2020_08_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :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(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type action_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class ProtocolSettings(msrest.serialization.Model): - """Protocol settings for file service. - - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2020_08_01_preview.models.SmbSetting - """ - - _attribute_map = { - 'smb': {'key': 'smb', 'type': 'SmbSetting'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtocolSettings, self).__init__(**kwargs) - self.smb = kwargs.get('smb', None) - - -class QueueServiceProperties(Resource): - """The properties of a storage account’s Queue service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(QueueServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class ResourceAccessRule(msrest.serialization.Model): - """Resource Access Rule. - - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceAccessRule, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.resource_id = kwargs.get('resource_id', None) - - -class RestorePolicyProperties(msrest.serialization.Model): - """The blob service properties for blob restore policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than - DeleteRetentionPolicy.days. - :type days: int - :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. - :vartype last_enabled_time: ~datetime.datetime - :ivar min_restore_time: Returns the minimum date and time that the restore can be started. - :vartype min_restore_time: ~datetime.datetime - """ - - _validation = { - 'enabled': {'required': True}, - 'days': {'maximum': 365, 'minimum': 1}, - 'last_enabled_time': {'readonly': True}, - 'min_restore_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePolicyProperties, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs.get('days', None) - self.last_enabled_time = None - self.min_restore_time = None - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class RoutingPreference(msrest.serialization.Model): - """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. - Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing - storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing - storage endpoints are to be published. - :type publish_internet_endpoints: bool - """ - - _attribute_map = { - 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, - 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, - 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingPreference, self).__init__(**kwargs) - self.routing_choice = kwargs.get('routing_choice', None) - self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) - self.publish_internet_endpoints = kwargs.get('publish_internet_endpoints', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: - list[~azure.mgmt.storage.v2020_08_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuInformation(msrest.serialization.Model): - """Storage SKU and its 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. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2020_08_01_preview.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SmbSetting(msrest.serialization.Model): - """Setting for SMB protocol. - - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2020_08_01_preview.models.Multichannel - """ - - _attribute_map = { - 'multichannel': {'key': 'multichannel', 'type': 'Multichannel'}, - } - - def __init__( - self, - **kwargs - ): - super(SmbSetting, self).__init__(**kwargs) - self.multichannel = kwargs.get('multichannel', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2020_08_01_preview.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2020_08_01_preview.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: - ~azure.mgmt.storage.v2020_08_01_preview.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage account. - :vartype private_endpoint_connections: - list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference - :ivar blob_restore_status: Blob restore status. - :vartype blob_restore_status: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'blob_restore_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.extended_location = kwargs.get('extended_location', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.private_endpoint_connections = None - self.routing_preference = kwargs.get('routing_preference', None) - self.blob_restore_status = None - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the - storage account will be created in Azure main region. Otherwise it will be created in the - specified extended location. - :type extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.extended_location = kwargs.get('extended_location', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageAccountInternetEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountInternetEndpoints, self).__init__(**kwargs) - self.blob = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageQueue(Resource): - """StorageQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - :ivar approximate_message_count: Integer indicating an approximate number of messages in the - queue. This number is not lower than the actual number of messages in the queue, but could be - higher. - :vartype approximate_message_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'approximate_message_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - self.approximate_message_count = None - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.SkuInformation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Table(Resource): - """Properties of the table, including Id, resource name, resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar table_name: Table name under the specified account. - :vartype table_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'table_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Table, self).__init__(**kwargs) - self.table_name = None - - -class TableServiceProperties(Resource): - """The properties of a storage account’s Table service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(TableServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class TagFilter(msrest.serialization.Model): - """Blob index tag based filtering for blob objects. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and - filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can - have 0 - 256 characters. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 128, 'min_length': 1}, - 'op': {'required': True}, - 'value': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'op': {'key': 'op', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagFilter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.op = kwargs['op'] - self.value = kwargs['value'] - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or - ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2020_08_01_preview.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2020_08_01_preview.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py index d7cabcdaa929..71c7f845641f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py @@ -20,31 +20,32 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -78,6 +79,35 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -94,19 +124,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -138,6 +168,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -178,6 +224,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -219,6 +267,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -228,12 +278,12 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2020_08_01_preview.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2020_08_01_preview.models.ActiveDirectoryProperties """ @@ -253,6 +303,15 @@ def __init__( active_directory_properties: Optional["ActiveDirectoryProperties"] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2020_08_01_preview.models.ActiveDirectoryProperties + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -281,15 +340,15 @@ class BlobContainer(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -301,8 +360,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyProperties @@ -370,6 +429,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.version = None self.deleted = None @@ -406,9 +478,8 @@ class BlobInventoryPolicy(Resource): :vartype system_data: ~azure.mgmt.storage.v2020_08_01_preview.models.SystemData :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicySchema + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicySchema """ _validation = { @@ -434,6 +505,11 @@ def __init__( policy: Optional["BlobInventoryPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicySchema + """ super(BlobInventoryPolicy, self).__init__(**kwargs) self.system_data = None self.last_modified_time = None @@ -445,8 +521,8 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyFilter + :ivar filters: Required. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyFilter """ _validation = { @@ -463,6 +539,10 @@ def __init__( filters: "BlobInventoryPolicyFilter", **kwargs ): + """ + :keyword filters: Required. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyFilter + """ super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) self.filters = filters @@ -472,15 +552,15 @@ class BlobInventoryPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value set to true. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :vartype include_snapshots: bool """ _validation = { @@ -503,6 +583,18 @@ def __init__( include_snapshots: Optional[bool] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Valid values include + blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value set to + true. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :paramtype include_snapshots: bool + """ super(BlobInventoryPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -515,13 +607,14 @@ class BlobInventoryPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyDefinition + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyDefinition """ _validation = { @@ -544,6 +637,16 @@ def __init__( definition: "BlobInventoryPolicyDefinition", **kwargs ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyDefinition + """ super(BlobInventoryPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -555,16 +658,16 @@ class BlobInventoryPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar destination: Required. Container name where blob inventory files are stored. Must be pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied + :vartype destination: str + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied when it is enabled. - :type rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyRule] """ _validation = { @@ -590,6 +693,18 @@ def __init__( rules: List["BlobInventoryPolicyRule"], **kwargs ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyRule] + """ super(BlobInventoryPolicySchema, self).__init__(**kwargs) self.enabled = enabled self.destination = destination @@ -602,10 +717,10 @@ class BlobRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreRange] + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreRange] """ _validation = { @@ -625,6 +740,12 @@ def __init__( blob_ranges: List["BlobRestoreRange"], **kwargs ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreRange] + """ super(BlobRestoreParameters, self).__init__(**kwargs) self.time_to_restore = time_to_restore self.blob_ranges = blob_ranges @@ -635,10 +756,10 @@ class BlobRestoreRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str """ _validation = { @@ -658,6 +779,12 @@ def __init__( end_range: str, **kwargs ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ super(BlobRestoreRange, self).__init__(**kwargs) self.start_range = start_range self.end_range = end_range @@ -700,6 +827,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -728,6 +857,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -747,32 +878,31 @@ class BlobServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2020_08_01_preview.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2020_08_01_preview.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.LastAccessTimeTrackingPolicy """ @@ -813,6 +943,37 @@ def __init__( last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2020_08_01_preview.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: + ~azure.mgmt.storage.v2020_08_01_preview.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2020_08_01_preview.models.LastAccessTimeTrackingPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -829,12 +990,12 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - :type retention_in_days: int + :vartype retention_in_days: int """ _validation = { @@ -853,6 +1014,14 @@ def __init__( retention_in_days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled self.retention_in_days = retention_in_days @@ -891,6 +1060,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -900,17 +1071,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2020_08_01_preview.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2020_08_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -929,6 +1100,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2020_08_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -941,22 +1125,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -985,6 +1169,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -996,9 +1198,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.CorsRule] """ _attribute_map = { @@ -1011,6 +1213,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -1020,12 +1227,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -1044,6 +1251,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -1054,9 +1269,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -1073,6 +1288,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -1080,13 +1300,13 @@ def __init__( class DateAfterModification(msrest.serialization.Model): """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - :param days_after_modification_greater_than: Value indicating the age in days after last + :ivar days_after_modification_greater_than: Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy. - :type days_after_last_access_time_greater_than: float + :vartype days_after_last_access_time_greater_than: float """ _validation = { @@ -1106,6 +1326,15 @@ def __init__( days_after_last_access_time_greater_than: Optional[float] = None, **kwargs ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than @@ -1142,6 +1371,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1197,6 +1428,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1231,6 +1464,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1241,12 +1476,12 @@ class DeletedShare(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str """ _validation = { @@ -1266,6 +1501,14 @@ def __init__( deleted_share_version: str, **kwargs ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ super(DeletedShare, self).__init__(**kwargs) self.deleted_share_name = deleted_share_name self.deleted_share_version = deleted_share_version @@ -1274,11 +1517,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -1297,6 +1540,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1305,10 +1555,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1323,6 +1573,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1333,17 +1589,18 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :vartype key_source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2020_08_01_preview.models.KeyVaultProperties + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: + ~azure.mgmt.storage.v2020_08_01_preview.models.KeyVaultProperties """ _validation = { @@ -1366,6 +1623,20 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2020_08_01_preview.models.KeyVaultProperties + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -1386,21 +1657,21 @@ class EncryptionScope(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + :vartype source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeState + :vartype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeState :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. :vartype creation_time: ~datetime.datetime :ivar last_modified_time: Gets the last modification date and time of the encryption scope in UTC. :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: + :vartype key_vault_properties: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeKeyVaultProperties """ @@ -1431,6 +1702,19 @@ def __init__( key_vault_properties: Optional["EncryptionScopeKeyVaultProperties"] = None, **kwargs ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeKeyVaultProperties + """ super(EncryptionScope, self).__init__(**kwargs) self.source = source self.state = state @@ -1442,10 +1726,10 @@ def __init__( class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :param key_uri: The object identifier for a key vault key object. When applied, the encryption + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - :type key_uri: str + :vartype key_uri: str """ _attribute_map = { @@ -1458,6 +1742,12 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri @@ -1488,6 +1778,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1498,17 +1790,17 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeyType + :vartype key_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeyType """ _validation = { @@ -1528,6 +1820,15 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.KeyType + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -1537,14 +1838,14 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService """ _attribute_map = { @@ -1563,6 +1864,16 @@ def __init__( queue: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -1587,11 +1898,11 @@ class Endpoints(msrest.serialization.Model): :vartype web: str :ivar dfs: Gets the dfs endpoint. :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountInternetEndpoints """ @@ -1622,6 +1933,14 @@ def __init__( internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, **kwargs ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountInternetEndpoints + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -1636,8 +1955,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the storage resource provider. - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2020_08_01_preview.models.ErrorResponseBody + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2020_08_01_preview.models.ErrorResponseBody """ _attribute_map = { @@ -1650,6 +1969,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2020_08_01_preview.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1657,12 +1980,12 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body contract. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1677,6 +2000,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1685,10 +2016,10 @@ def __init__( class ExtendedLocation(msrest.serialization.Model): """The complex type of the extended location. - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocationTypes """ _attribute_map = { @@ -1703,6 +2034,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -1729,6 +2066,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1748,15 +2087,15 @@ class FileServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: + :vartype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2020_08_01_preview.models.ProtocolSettings + :ivar protocol_settings: Protocol settings for file service. + :vartype protocol_settings: ~azure.mgmt.storage.v2020_08_01_preview.models.ProtocolSettings """ _validation = { @@ -1784,6 +2123,17 @@ def __init__( protocol_settings: Optional["ProtocolSettings"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2020_08_01_preview.models.DeleteRetentionPolicy + :keyword protocol_settings: Protocol settings for file service. + :paramtype protocol_settings: ~azure.mgmt.storage.v2020_08_01_preview.models.ProtocolSettings + """ super(FileServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -1808,17 +2158,18 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1827,10 +2178,10 @@ class FileShare(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -1891,6 +2242,24 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1925,17 +2294,18 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1944,10 +2314,10 @@ class FileShareItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2008,6 +2378,24 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ShareAccessTier + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2051,6 +2439,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2094,6 +2484,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2133,6 +2525,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2153,18 +2547,18 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2192,6 +2586,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -2208,18 +2613,18 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2020_08_01_preview.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2243,6 +2648,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -2256,12 +2672,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -2280,6 +2696,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -2290,12 +2714,12 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -2324,6 +2748,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2337,18 +2769,18 @@ class LastAccessTimeTrackingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in + :vartype name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only. - :type blob_type: list[str] + :vartype blob_type: list[str] """ _validation = { @@ -2371,6 +2803,20 @@ def __init__( blob_type: Optional[List[str]] = None, **kwargs ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) self.enable = enable self.name = name @@ -2383,20 +2829,21 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2421,6 +2868,23 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2432,11 +2896,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2451,6 +2915,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2468,9 +2939,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -2489,6 +2960,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2504,8 +2980,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagProperty] """ _validation = { @@ -2523,6 +2999,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2549,6 +3029,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2574,6 +3056,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2601,15 +3085,15 @@ class ListContainerItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -2621,8 +3105,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicyProperties @@ -2690,6 +3174,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.version = None self.deleted = None @@ -2735,6 +3232,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2753,8 +3252,8 @@ class ListQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] """ _validation = { @@ -2776,6 +3275,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = metadata @@ -2805,6 +3308,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2831,6 +3336,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2856,6 +3363,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2885,6 +3394,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2911,6 +3422,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2930,9 +3443,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySchema """ _validation = { @@ -2956,6 +3469,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -2964,12 +3482,12 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyVersion + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyVersion """ _attribute_map = { @@ -2986,6 +3504,14 @@ def __init__( version: Optional["ManagementPolicyVersion"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyVersion + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -2995,18 +3521,17 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool + :vartype tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool """ _attribute_map = { @@ -3025,6 +3550,21 @@ def __init__( enable_auto_tier_to_hot_from_cool: Optional[bool] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: + ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3037,10 +3577,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyFilter """ _validation = { @@ -3059,6 +3599,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -3069,14 +3615,14 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag filters. - :type blob_index_match: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagFilter] + :vartype blob_index_match: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagFilter] """ _validation = { @@ -3097,6 +3643,16 @@ def __init__( blob_index_match: Optional[List["TagFilter"]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2020_08_01_preview.models.TagFilter] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -3108,15 +3664,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyDefinition """ _validation = { @@ -3141,6 +3697,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -3153,9 +3721,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyRule] """ _validation = { @@ -3172,6 +3740,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -3179,14 +3752,14 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation """ _attribute_map = { @@ -3203,6 +3776,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3212,14 +3795,14 @@ def __init__( class ManagementPolicyVersion(msrest.serialization.Model): """Management policy action for blob version. - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation """ _attribute_map = { @@ -3236,6 +3819,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2020_08_01_preview.models.DateAfterCreation + """ super(ManagementPolicyVersion, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3245,24 +3838,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -3291,6 +3884,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3306,8 +3919,8 @@ def __init__( class Multichannel(msrest.serialization.Model): """Multichannel setting. Applies to Premium FileStorage only. - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -3320,6 +3933,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = enabled @@ -3329,22 +3946,22 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Bypass - :param resource_access_rules: - :type resource_access_rules: + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Bypass + :ivar resource_access_rules: + :vartype resource_access_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.DefaultAction """ _validation = { @@ -3369,6 +3986,24 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Bypass + :keyword resource_access_rules: + :paramtype resource_access_rules: + list[~azure.mgmt.storage.v2020_08_01_preview.models.ResourceAccessRule] + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2020_08_01_preview.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.resource_access_rules = resource_access_rules @@ -3380,8 +4015,8 @@ def __init__( class ObjectReplicationPolicies(msrest.serialization.Model): """List storage account object replication policies. - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy] + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy] """ _attribute_map = { @@ -3394,6 +4029,10 @@ def __init__( value: Optional[List["ObjectReplicationPolicy"]] = None, **kwargs ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy] + """ super(ObjectReplicationPolicies, self).__init__(**kwargs) self.value = value @@ -3415,12 +4054,13 @@ class ObjectReplicationPolicy(Resource): :vartype policy_id: str :ivar enabled_time: Indicates when the policy is enabled on the source account. :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyRule] + :ivar source_account: Required. Source account name. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: + list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyRule] """ _validation = { @@ -3450,6 +4090,15 @@ def __init__( rules: Optional[List["ObjectReplicationPolicyRule"]] = None, **kwargs ): + """ + :keyword source_account: Required. Source account name. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: + list[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyRule] + """ super(ObjectReplicationPolicy, self).__init__(**kwargs) self.policy_id = None self.enabled_time = None @@ -3461,12 +4110,12 @@ def __init__( class ObjectReplicationPolicyFilter(msrest.serialization.Model): """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str """ _attribute_map = { @@ -3481,6 +4130,14 @@ def __init__( min_creation_time: Optional[str] = None, **kwargs ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.min_creation_time = min_creation_time @@ -3491,15 +4148,15 @@ class ObjectReplicationPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyFilter + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyFilter """ _validation = { @@ -3523,6 +4180,18 @@ def __init__( filters: Optional["ObjectReplicationPolicyFilter"] = None, **kwargs ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: + ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicyFilter + """ super(ObjectReplicationPolicyRule, self).__init__(**kwargs) self.rule_id = rule_id self.source_container = source_container @@ -3533,14 +4202,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2020_08_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2020_08_01_preview.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2020_08_01_preview.models.ServiceSpecification """ @@ -3560,6 +4229,17 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2020_08_01_preview.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: + ~azure.mgmt.storage.v2020_08_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3570,14 +4250,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -3596,6 +4276,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3606,8 +4296,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Operation] """ _attribute_map = { @@ -3620,6 +4310,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -3645,6 +4339,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3662,11 +4358,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -3697,6 +4393,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -3706,8 +4410,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection] """ _attribute_map = { @@ -3720,6 +4424,11 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: + list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -3741,8 +4450,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -3768,6 +4477,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -3777,8 +4490,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkResource] """ _attribute_map = { @@ -3791,6 +4504,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -3798,15 +4515,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -3823,6 +4540,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -3832,8 +4560,8 @@ def __init__( class ProtocolSettings(msrest.serialization.Model): """Protocol settings for file service. - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2020_08_01_preview.models.SmbSetting + :ivar smb: Setting for SMB protocol. + :vartype smb: ~azure.mgmt.storage.v2020_08_01_preview.models.SmbSetting """ _attribute_map = { @@ -3846,6 +4574,10 @@ def __init__( smb: Optional["SmbSetting"] = None, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2020_08_01_preview.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = smb @@ -3863,10 +4595,10 @@ class QueueServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules """ _validation = { @@ -3888,6 +4620,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + """ super(QueueServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -3895,10 +4633,10 @@ def __init__( class ResourceAccessRule(msrest.serialization.Model): """Resource Access Rule. - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar resource_id: Resource Id. + :vartype resource_id: str """ _attribute_map = { @@ -3913,6 +4651,12 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ super(ResourceAccessRule, self).__init__(**kwargs) self.tenant_id = tenant_id self.resource_id = resource_id @@ -3925,11 +4669,11 @@ class RestorePolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than + :ivar enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - :type days: int + :vartype days: int :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. :vartype last_enabled_time: ~datetime.datetime :ivar min_restore_time: Returns the minimum date and time that the restore can be started. @@ -3957,6 +4701,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -3974,11 +4725,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ReasonCode """ _validation = { @@ -3998,6 +4749,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -4007,15 +4765,15 @@ def __init__( class RoutingPreference(msrest.serialization.Model): """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + :vartype routing_choice: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing storage endpoints are to be published. - :type publish_internet_endpoints: bool + :vartype publish_internet_endpoints: bool """ _attribute_map = { @@ -4032,6 +4790,17 @@ def __init__( publish_internet_endpoints: Optional[bool] = None, **kwargs ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ super(RoutingPreference, self).__init__(**kwargs) self.routing_choice = routing_choice self.publish_microsoft_endpoints = publish_microsoft_endpoints @@ -4043,49 +4812,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -4137,6 +4905,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2020_08_01_preview.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -4161,8 +4975,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.storage.v2020_08_01_preview.models.MetricSpecification] """ @@ -4176,6 +4990,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2020_08_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4187,11 +5006,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuTier @@ -4213,6 +5032,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4244,6 +5070,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4256,11 +5084,11 @@ class SkuInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuTier @@ -4275,9 +5103,9 @@ class SkuInformation(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2020_08_01_preview.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Restriction] """ _validation = { @@ -4306,6 +5134,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2020_08_01_preview.models.Restriction] + """ super(SkuInformation, self).__init__(**kwargs) self.name = name self.tier = None @@ -4319,8 +5157,8 @@ def __init__( class SmbSetting(msrest.serialization.Model): """Setting for SMB protocol. - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2020_08_01_preview.models.Multichannel + :ivar multichannel: Multichannel setting. Applies to Premium FileStorage only. + :vartype multichannel: ~azure.mgmt.storage.v2020_08_01_preview.models.Multichannel """ _attribute_map = { @@ -4333,6 +5171,10 @@ def __init__( multichannel: Optional["Multichannel"] = None, **kwargs ): + """ + :keyword multichannel: Multichannel setting. Applies to Premium FileStorage only. + :paramtype multichannel: ~azure.mgmt.storage.v2020_08_01_preview.models.Multichannel + """ super(SmbSetting, self).__init__(**kwargs) self.multichannel = multichannel @@ -4352,10 +5194,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -4380,6 +5222,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -4400,19 +5248,19 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or @@ -4453,48 +5301,48 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2020_08_01_preview.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState :ivar private_endpoint_connections: List of private endpoint connection associated with the specified storage account. :vartype private_endpoint_connections: list[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference + :vartype routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference :ivar blob_restore_status: Blob restore status. :vartype blob_restore_status: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _validation = { @@ -4577,6 +5425,45 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -4616,8 +5503,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -4641,6 +5528,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -4650,68 +5541,68 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the + :vartype location: str + :ivar extended_location: Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location. - :type extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _validation = { @@ -4764,6 +5655,70 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword extended_location: Optional. Set the extended location of the resource. If not set, + the storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :paramtype extended_location: ~azure.mgmt.storage.v2020_08_01_preview.models.ExtendedLocation + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -4818,6 +5773,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4855,6 +5812,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4883,6 +5842,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4913,6 +5874,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4959,6 +5922,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -4973,9 +5938,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -4992,6 +5957,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -4999,59 +5969,58 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _attribute_map = { @@ -5092,6 +6061,62 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2020_08_01_preview.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2020_08_01_preview.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2020_08_01_preview.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2020_08_01_preview.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2020_08_01_preview.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2020_08_01_preview.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2020_08_01_preview.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2020_08_01_preview.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2020_08_01_preview.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -5123,8 +6148,8 @@ class StorageQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] :ivar approximate_message_count: Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. @@ -5152,6 +6177,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = metadata self.approximate_message_count = None @@ -5178,6 +6207,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5185,21 +6216,21 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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.storage.v2020_08_01_preview.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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.storage.v2020_08_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -5222,6 +6253,23 @@ def __init__( 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.storage.v2020_08_01_preview.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.storage.v2020_08_01_preview.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 @@ -5266,6 +6314,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5283,10 +6333,10 @@ class TableServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules """ _validation = { @@ -5308,6 +6358,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2020_08_01_preview.models.CorsRules + """ super(TableServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -5317,14 +6373,14 @@ class TagFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters. - :type value: str + :vartype value: str """ _validation = { @@ -5347,6 +6403,16 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ super(TagFilter, self).__init__(**kwargs) self.name = name self.op = op @@ -5390,6 +6456,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5443,6 +6511,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5486,6 +6556,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5496,8 +6568,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Usage] """ _attribute_map = { @@ -5510,6 +6582,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2020_08_01_preview.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -5539,6 +6615,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5549,15 +6627,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.State + :vartype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.State """ _validation = { @@ -5578,6 +6656,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2020_08_01_preview.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py index 80c516d5a23e..49349134035e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,11 +26,11 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class BlobInventoryPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. @@ -55,7 +40,7 @@ class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En COMPLETE = "Complete" FAILED = "Failed" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -66,7 +51,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -76,7 +61,7 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -85,14 +70,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -100,7 +85,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication protocol that is used for the file share. Can only be specified when creating a share. """ @@ -108,7 +93,7 @@ class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SMB = "SMB" NFS = "NFS" -class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. """ @@ -116,20 +101,20 @@ class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class EncryptionScopeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -141,21 +126,21 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -164,20 +149,20 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class InventoryRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Inventory """ INVENTORY = "Inventory" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -185,7 +170,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. @@ -194,7 +179,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE = "Service" ACCOUNT = "Account" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -204,14 +189,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -221,7 +206,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -229,7 +214,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -239,27 +224,27 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ListContainersInclude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" -class ListSharesExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListSharesExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" SNAPSHOTS = "snapshots" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -268,13 +253,13 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only """ ACCESS_TIME_TRACKING = "AccessTimeTracking" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -288,7 +273,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -297,7 +282,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -305,7 +290,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -313,7 +298,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -321,7 +306,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -329,7 +314,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -339,7 +324,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The property is for NFS share only. The default is NoRootSquash. """ @@ -347,20 +332,20 @@ class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class RoutingChoice(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Routing Choice defines the kind of network routing opted by the user. """ MICROSOFT_ROUTING = "MicrosoftRouting" INTERNET_ROUTING = "InternetRouting" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -370,7 +355,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. """ @@ -380,7 +365,7 @@ class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" PREMIUM = "Premium" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -390,7 +375,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -400,7 +385,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -414,14 +399,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -431,12 +416,12 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class StorageAccountExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO_REPLICATION_STATS = "geoReplicationStats" BLOB_RESTORE_STATUS = "blobRestoreStatus" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py index fdfe7b1c84e8..80cf10817e99 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py @@ -5,23 +5,593 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,16 +615,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - include=None, # type: Optional[Union[str, "_models.ListContainersInclude"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -75,7 +645,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListContainerItems] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -83,42 +654,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,20 +704,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -178,33 +747,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,17 +781,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -260,33 +821,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,16 +851,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -334,28 +887,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +912,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -403,26 +948,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,15 +972,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -472,33 +1010,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,17 +1040,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -550,33 +1080,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -590,18 +1110,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -634,40 +1156,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,23 +1186,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -723,32 +1235,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,23 +1257,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the @@ -806,31 +1308,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -840,23 +1330,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -886,29 +1379,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -918,24 +1401,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -969,37 +1455,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1009,23 +1485,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1053,36 +1532,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,4 +1565,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py index f6435704b3d8..36235cc9969a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +222,8 @@ def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy @@ -75,34 +234,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -111,17 +260,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - properties, # type: "_models.BlobInventoryPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Sets the blob inventory policy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -133,7 +284,8 @@ def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -146,39 +298,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -187,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: """Deletes the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -208,7 +352,8 @@ def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicyName :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 @@ -219,34 +364,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -254,13 +389,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListBlobInventoryPolicy"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -271,8 +407,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -280,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -322,12 +457,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py index 4e4a4c9648e7..55d1e075ff17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +184,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceItems] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -71,36 +193,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +237,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +274,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +303,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +334,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +358,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py index a730ed5b5a75..97fadf589f28 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py @@ -5,23 +5,91 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + deleted_account_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}') + path_format_arguments = { + "deletedAccountName": _SERIALIZER.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,16 +113,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedAccountListResult"]: """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -62,34 +132,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,24 +167,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace def get( self, - deleted_account_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedAccount" + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": """Get properties of specified deleted account resource. :param deleted_account_name: Name of the deleted storage account. @@ -136,33 +202,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -171,4 +227,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py index d4b67060766b..df4a728e0e6d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py @@ -5,23 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,15 +212,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. @@ -82,39 +249,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -127,17 +284,19 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. @@ -165,39 +324,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -206,16 +355,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": """Returns the properties for the specified encryption scope. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -240,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -276,15 +417,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionScopeListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: """Lists all the encryption scopes available under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -295,8 +438,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -304,36 +449,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,6 +493,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py index c9735efb61a9..e4796c17d541 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py index 4b8775427c54..86adf7d1be22 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py @@ -5,23 +5,297 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, "_models.ListSharesExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + expand: Optional[str] = "snapshots", + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + 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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = "stats", + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +319,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - expand=None, # type: Optional[Union[str, "_models.ListSharesExpand"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, "_models.ListSharesExpand"]] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -74,7 +348,8 @@ def list( :type expand: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ListSharesExpand :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.FileShareItems] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -82,42 +357,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,21 +407,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - expand="snapshots", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[str] = "snapshots", + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -168,7 +441,7 @@ def create( :type share_name: str :param file_share: Properties of the file share to create. :type file_share: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare - :param expand: Optional, used to create a snapshot. + :param expand: Optional, used to create a snapshot. The default value is "snapshots". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FileShare, or the result of cls(response) @@ -180,35 +453,24 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,17 +488,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -264,33 +528,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,18 +558,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - expand="stats", # type: Optional[str] - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = "stats", + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -330,7 +586,8 @@ def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. :type x_ms_snapshot: str @@ -344,32 +601,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -383,17 +628,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -420,30 +667,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -456,15 +692,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def restore( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - deleted_share, # type: "_models.DeletedShare" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: """Restore a file share within a valid retention days if share soft delete is enabled. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -491,33 +728,23 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -529,3 +756,4 @@ def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py index a574f0faf92b..87e44be371d5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py index a0584631928d..67188f61e351 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ObjectReplicationPolicies"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: """List the object replication policies associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Get the object replication policy of the storage account by policy ID. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -154,34 +312,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -190,17 +338,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - properties, # type: "_models.ObjectReplicationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Create or update the object replication policy of the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -226,39 +376,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -267,16 +407,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: """Deletes the object replication policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -299,37 +441,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py index 01b0b2fe6131..2cb78c470cf9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2020_08_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py index 34484db5e4b5..9479f31f363f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,17 +337,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -224,39 +374,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -265,16 +405,18 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -297,37 +439,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py index 67d7350740c2..865fc783c608 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +107,17 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +131,6 @@ def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py index 0294214d9c3d..5aeb792bdb54 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): """QueueOperations operations. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -80,33 +291,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +321,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -157,33 +360,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,16 +390,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": """Gets the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -231,28 +426,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -266,16 +451,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -300,28 +487,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -334,15 +511,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListQueueResource"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: """Gets a list of all the queues under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -360,7 +538,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListQueueResource] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -368,40 +547,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +595,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py index 6fa83d5808b5..05e82e4ea813 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListQueueServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": """List all queue services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.QueueServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py index 42f8fbad937a..865105c90231 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py index 7db5cf712d13..029662b060ae 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py @@ -5,25 +5,561 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +583,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.CheckNameAvailabilityResult @@ -69,30 +606,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +633,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +680,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +708,20 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +733,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +759,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +788,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +811,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -332,29 +845,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +870,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -406,32 +910,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,19 +939,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -465,34 +963,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +1003,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -528,8 +1022,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -537,35 +1033,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -583,19 +1075,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -606,7 +1099,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -618,29 +1112,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,16 +1137,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -675,7 +1160,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListKeysResult @@ -686,32 +1172,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,16 +1201,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -756,32 +1234,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,16 +1263,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -826,32 +1296,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,39 +1325,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,13 +1363,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -930,15 +1384,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -952,21 +1408,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -978,47 +1427,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore def _restore_blob_ranges_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobRestoreStatus" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,16 +1475,18 @@ def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace def begin_restore_blob_ranges( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BlobRestoreStatus"] + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: """Restore blobs in the specified blob ranges. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1059,15 +1500,20 @@ def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2020_08_01_preview.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1079,27 +1525,21 @@ def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1111,15 +1551,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1139,25 +1580,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1169,3 +1602,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py index e5a6604d42db..fc8fb783e0c5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): """TableOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -76,28 +261,18 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,16 +286,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -144,28 +321,18 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,16 +346,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Gets the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -212,28 +381,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,16 +406,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -280,28 +441,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -314,13 +465,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListTableResource"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: """Gets a list of all the tables under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -332,7 +484,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListTableResource] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -340,36 +493,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -387,6 +537,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py index 9d2239e03bcb..ec36f4c089f6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01-preview" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): """TableServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListTableServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": """List all table services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.TableServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": """Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": """Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py index 7e57fa403c88..ed8f319ecede 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -58,7 +93,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.UsageListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2020_08_01_preview.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -66,35 +102,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +144,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py index 5b966a0f0ab8..eb11f3bc54bd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json index 084c5bc5aad0..43e3fdf5b6fa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py index 744672f00947..cb38cc1147d4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py @@ -6,42 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -55,17 +35,23 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_01_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_01_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_01_01.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_01_01.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_01_01.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_01_01.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_01_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_01_01.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_01_01.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_01_01.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_01_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_01_01.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_01_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_01_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -86,84 +72,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py index bd5adf83c433..f4d719417063 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py index 4c94224182e8..c0bb8c66dbdc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py @@ -6,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -47,27 +29,36 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2021_01_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2021_01_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2021_01_01.aio.operations.StorageAccountsOperations :ivar deleted_accounts: DeletedAccountsOperations operations - :vartype deleted_accounts: azure.mgmt.storage.v2021_01_01.aio.operations.DeletedAccountsOperations + :vartype deleted_accounts: + azure.mgmt.storage.v2021_01_01.aio.operations.DeletedAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_01_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_01_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_01_01.aio.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_01_01.aio.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_01_01.aio.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_01_01.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_01_01.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_01_01.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_01_01.aio.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_01_01.aio.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_01_01.aio.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_01_01.aio.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_01_01.aio.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_01_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2021_01_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2021_01_01.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations :vartype file_services: azure.mgmt.storage.v2021_01_01.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations @@ -84,82 +75,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py index 5ec25418be87..6bb6f43e3dd2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2021_01_01.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -172,33 +178,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,8 +212,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -253,33 +252,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,8 +282,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -326,28 +318,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,8 +343,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,26 +379,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,6 +403,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -462,33 +441,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,8 +471,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -539,33 +511,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,8 +541,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -622,40 +587,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,14 +617,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -710,32 +666,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -745,14 +688,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -792,31 +739,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -826,14 +761,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -871,29 +810,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -903,14 +832,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -953,37 +886,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -993,14 +916,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1036,36 +963,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,4 +996,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py index 0db3d9b56f5d..238b0d6a1c9c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -106,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -127,7 +127,8 @@ async def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,39 +141,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -181,8 +172,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,7 +195,8 @@ async def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName :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 @@ -212,34 +207,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -247,6 +232,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -263,8 +250,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -272,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -314,12 +300,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py index a574ef16887d..98e8bfc3ee34 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py index caedd8cb02e0..ebe91e42f093 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._deleted_accounts_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,17 +100,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace_async async def get( self, deleted_account_name: str, @@ -130,33 +135,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -165,4 +160,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py index 23a478dcc082..626553538120 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def put( self, resource_group_name: str, @@ -77,39 +83,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -122,8 +118,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -159,39 +158,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -200,8 +189,11 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,34 +225,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -269,8 +251,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -287,8 +272,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -296,36 +283,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -343,6 +327,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py index 766c575c1a8a..aea54c6e5e5e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py index 24a24b197fdb..7bad8db4ed58 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_restore_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list( :type expand: str or ~azure.mgmt.storage.v2021_01_01.models.ListSharesExpand :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -77,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +134,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -174,35 +180,24 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,8 +215,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -257,33 +255,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -297,8 +285,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -322,7 +313,8 @@ async def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. :type x_ms_snapshot: str @@ -336,32 +328,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,8 +355,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -411,30 +394,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -447,6 +419,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def restore( self, resource_group_name: str, @@ -481,33 +455,23 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -519,3 +483,4 @@ async def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py index 1ea23a614d2b..8fe75b82a28d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py index 21ab00380dff..fc657773b106 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -148,34 +155,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -184,8 +181,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -219,39 +219,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -260,8 +250,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -291,37 +284,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py index 8c61f7a1cef6..6e451b49b564 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py index 8672b403dac4..fa430ce78543 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -217,39 +217,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -258,8 +248,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -289,37 +282,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py index 7ec8b65a6d38..4b8ac11aa009 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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_list_by_storage_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_account( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,4 +94,6 @@ async def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py index c65263b21845..0df00dfdec06 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -75,33 +81,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +111,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -151,33 +150,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,8 +180,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,28 +216,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,8 +241,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -292,28 +277,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -326,6 +301,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -351,7 +328,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListQueueResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -359,40 +337,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -410,6 +385,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py index 50d8d539200a..67d87744f9ef 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueueServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py index c1d7a093c045..2adedceda8b2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py index 25959d4c323d..b84305e70585 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_01_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_01_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_01_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -323,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -396,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -445,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -516,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -593,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -605,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -661,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_01_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountListKeysResult @@ -672,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -741,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -810,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -862,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -893,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -912,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -934,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -960,6 +892,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore async def _restore_blob_ranges_initial( @@ -974,32 +907,22 @@ async def _restore_blob_ranges_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,8 +940,11 @@ async def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async async def begin_restore_blob_ranges( self, resource_group_name: str, @@ -1039,15 +965,20 @@ async def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_01_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1059,27 +990,21 @@ async def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1091,8 +1016,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -1118,25 +1045,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1148,3 +1067,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py index a3a14fac8cac..71f89b48abff 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -71,28 +77,18 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +102,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,28 +137,18 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,8 +162,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,28 +197,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +222,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -272,28 +257,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,6 +281,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -323,7 +300,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListTableResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -331,36 +309,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -378,6 +353,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py index 7eae020c5aa5..ac6dab289036 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TableServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py index 8533cd128a13..a2cf547af05b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_01_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py index 46749abf487c..aae11c1849bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py @@ -6,264 +6,135 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobInventoryPolicy - from ._models_py3 import BlobInventoryPolicyDefinition - from ._models_py3 import BlobInventoryPolicyFilter - from ._models_py3 import BlobInventoryPolicyRule - from ._models_py3 import BlobInventoryPolicySchema - from ._models_py3 import BlobRestoreParameters - from ._models_py3 import BlobRestoreRange - from ._models_py3 import BlobRestoreStatus - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import DeletedAccount - from ._models_py3 import DeletedAccountListResult - from ._models_py3 import DeletedShare - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionIdentity - from ._models_py3 import EncryptionScope - from ._models_py3 import EncryptionScopeKeyVaultProperties - from ._models_py3 import EncryptionScopeListResult - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import ExtendedLocation - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LastAccessTimeTrackingPolicy - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListBlobInventoryPolicy - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListQueue - from ._models_py3 import ListQueueResource - from ._models_py3 import ListQueueServices - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ListTableResource - from ._models_py3 import ListTableServices - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import ManagementPolicyVersion - from ._models_py3 import MetricSpecification - from ._models_py3 import Multichannel - from ._models_py3 import NetworkRuleSet - from ._models_py3 import ObjectReplicationPolicies - from ._models_py3 import ObjectReplicationPolicy - from ._models_py3 import ObjectReplicationPolicyFilter - from ._models_py3 import ObjectReplicationPolicyRule - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProtocolSettings - from ._models_py3 import ProxyResource - from ._models_py3 import QueueServiceProperties - from ._models_py3 import Resource - from ._models_py3 import ResourceAccessRule - from ._models_py3 import RestorePolicyProperties - from ._models_py3 import Restriction - from ._models_py3 import RoutingPreference - from ._models_py3 import SKUCapability - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuInformation - from ._models_py3 import SmbSetting - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountInternetEndpoints - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountMicrosoftEndpoints - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageQueue - from ._models_py3 import StorageSkuListResult - from ._models_py3 import SystemData - from ._models_py3 import Table - from ._models_py3 import TableServiceProperties - from ._models_py3 import TagFilter - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import UserAssignedIdentity - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobInventoryPolicy # type: ignore - from ._models import BlobInventoryPolicyDefinition # type: ignore - from ._models import BlobInventoryPolicyFilter # type: ignore - from ._models import BlobInventoryPolicyRule # type: ignore - from ._models import BlobInventoryPolicySchema # type: ignore - from ._models import BlobRestoreParameters # type: ignore - from ._models import BlobRestoreRange # type: ignore - from ._models import BlobRestoreStatus # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import DeletedAccount # type: ignore - from ._models import DeletedAccountListResult # type: ignore - from ._models import DeletedShare # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionIdentity # type: ignore - from ._models import EncryptionScope # type: ignore - from ._models import EncryptionScopeKeyVaultProperties # type: ignore - from ._models import EncryptionScopeListResult # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LastAccessTimeTrackingPolicy # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListBlobInventoryPolicy # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListQueue # type: ignore - from ._models import ListQueueResource # type: ignore - from ._models import ListQueueServices # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ListTableResource # type: ignore - from ._models import ListTableServices # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import ManagementPolicyVersion # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import Multichannel # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import ObjectReplicationPolicies # type: ignore - from ._models import ObjectReplicationPolicy # type: ignore - from ._models import ObjectReplicationPolicyFilter # type: ignore - from ._models import ObjectReplicationPolicyRule # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProtocolSettings # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueueServiceProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceAccessRule # type: ignore - from ._models import RestorePolicyProperties # type: ignore - from ._models import Restriction # type: ignore - from ._models import RoutingPreference # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SmbSetting # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountInternetEndpoints # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountMicrosoftEndpoints # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageQueue # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import Table # type: ignore - from ._models import TableServiceProperties # type: ignore - from ._models import TagFilter # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import UserAssignedIdentity # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedAccount +from ._models_py3 import DeletedAccountListResult +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionIdentity +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import Multichannel +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProtocolSettings +from ._models_py3 import ProxyResource +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceAccessRule +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import SmbSetting +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models.py deleted file mode 100644 index 21a22e103718..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models.py +++ /dev/null @@ -1,5289 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_01_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2021_01_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2021_01_01.models.ActiveDirectoryProperties - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_01_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobInventoryPolicy(Resource): - """The storage account blob inventory policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.storage.v2021_01_01.models.SystemData - :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. - :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicy, self).__init__(**kwargs) - self.system_data = None - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class BlobInventoryPolicyDefinition(msrest.serialization.Model): - """An object that defines the blob inventory rule. Each definition consists of a set of filters. - - All required parameters must be populated in order to send to Azure. - - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyFilter - """ - - _validation = { - 'filters': {'required': True}, - } - - _attribute_map = { - 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) - self.filters = kwargs['filters'] - - -class BlobInventoryPolicyFilter(msrest.serialization.Model): - """An object that defines the blob inventory rule filter conditions. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, - 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.include_blob_versions = kwargs.get('include_blob_versions', None) - self.include_snapshots = kwargs.get('include_snapshots', None) - - -class BlobInventoryPolicyRule(msrest.serialization.Model): - """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyDefinition - """ - - _validation = { - 'enabled': {'required': True}, - 'name': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.name = kwargs['name'] - self.definition = kwargs['definition'] - - -class BlobInventoryPolicySchema(msrest.serialization.Model): - """The storage account blob inventory policy rules. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be - pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied - when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyRule] - """ - - _validation = { - 'enabled': {'required': True}, - 'destination': {'required': True}, - 'type': {'required': True}, - 'rules': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicySchema, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.destination = kwargs['destination'] - self.type = kwargs['type'] - self.rules = kwargs['rules'] - - -class BlobRestoreParameters(msrest.serialization.Model): - """Blob restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreRange] - """ - - _validation = { - 'time_to_restore': {'required': True}, - 'blob_ranges': {'required': True}, - } - - _attribute_map = { - 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, - 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreParameters, self).__init__(**kwargs) - self.time_to_restore = kwargs['time_to_restore'] - self.blob_ranges = kwargs['blob_ranges'] - - -class BlobRestoreRange(msrest.serialization.Model): - """Blob range. - - All required parameters must be populated in order to send to Azure. - - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str - """ - - _validation = { - 'start_range': {'required': True}, - 'end_range': {'required': True}, - } - - _attribute_map = { - 'start_range': {'key': 'startRange', 'type': 'str'}, - 'end_range': {'key': 'endRange', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreRange, self).__init__(**kwargs) - self.start_range = kwargs['start_range'] - self.end_range = kwargs['end_range'] - - -class BlobRestoreStatus(msrest.serialization.Model): - """Blob restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates - that blob restore is ongoing. - Complete: Indicates that blob restore has been completed - successfully. - Failed: Indicates that blob restore is failed. Possible values include: - "InProgress", "Complete", "Failed". - :vartype status: str or ~azure.mgmt.storage.v2021_01_01.models.BlobRestoreProgressStatus - :ivar failure_reason: Failure reason when blob restore is failed. - :vartype failure_reason: str - :ivar restore_id: Id for tracking blob restore request. - :vartype restore_id: str - :ivar parameters: Blob restore request parameters. - :vartype parameters: ~azure.mgmt.storage.v2021_01_01.models.BlobRestoreParameters - """ - - _validation = { - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'restore_id': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - 'restore_id': {'key': 'restoreId', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreStatus, self).__init__(**kwargs) - self.status = None - self.failure_reason = None - self.restore_id = None - self.parameters = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_01_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_01_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: - ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: - ~azure.mgmt.storage.v2021_01_01.models.LastAccessTimeTrackingPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, - 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.is_versioning_enabled = kwargs.get('is_versioning_enabled', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - self.restore_policy = kwargs.get('restore_policy', None) - self.container_delete_retention_policy = kwargs.get('container_delete_retention_policy', None) - self.last_access_time_tracking_policy = kwargs.get('last_access_time_tracking_policy', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value - is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite - retention of the change feed. - :type retention_in_days: int - """ - - _validation = { - 'retention_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.retention_in_days = kwargs.get('retention_in_days', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2021_01_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_01_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2021_01_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2021_01_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - - :param days_after_modification_greater_than: Value indicating the age in days after last - modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last - blob access. This property can only be used in conjunction with last access time tracking - policy. - :type days_after_last_access_time_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, - 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) - self.days_after_last_access_time_greater_than = kwargs.get('days_after_last_access_time_greater_than', None) - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class DeletedAccount(ProxyResource): - """Deleted storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar storage_account_resource_id: Full resource id of the original storage account. - :vartype storage_account_resource_id: str - :ivar location: Location of the deleted account. - :vartype location: str - :ivar restore_reference: Can be used to attempt recovering this deleted account via - PutStorageAccount API. - :vartype restore_reference: str - :ivar creation_time: Creation time of the deleted account. - :vartype creation_time: str - :ivar deletion_time: Deletion time of the deleted account. - :vartype deletion_time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'storage_account_resource_id': {'readonly': True}, - 'location': {'readonly': True}, - 'restore_reference': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'deletion_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'restore_reference': {'key': 'properties.restoreReference', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'deletion_time': {'key': 'properties.deletionTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccount, self).__init__(**kwargs) - self.storage_account_resource_id = None - self.location = None - self.restore_reference = None - self.creation_time = None - self.deletion_time = None - - -class DeletedAccountListResult(msrest.serialization.Model): - """The response from the List Deleted Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of deleted accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.DeletedAccount] - :ivar next_link: Request URL that can be used to query next page of deleted accounts. Returned - when total number of requested deleted accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DeletedShare(msrest.serialization.Model): - """The deleted share to be restored. - - All required parameters must be populated in order to send to Azure. - - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will - be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str - """ - - _validation = { - 'deleted_share_name': {'required': True}, - 'deleted_share_version': {'required': True}, - } - - _attribute_map = { - 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, - 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedShare, self).__init__(**kwargs) - self.deleted_share_name = kwargs['deleted_share_name'] - self.deleted_share_version = kwargs['deleted_share_version'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_01_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_01_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_01_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_01_01.models.EncryptionIdentity - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - 'encryption_identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.encryption_identity = kwargs.get('encryption_identity', None) - - -class EncryptionIdentity(msrest.serialization.Model): - """Encryption identity for the storage account. - - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str - """ - - _attribute_map = { - 'encryption_user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionIdentity, self).__init__(**kwargs) - self.encryption_user_assigned_identity = kwargs.get('encryption_user_assigned_identity', None) - - -class EncryptionScope(Resource): - """The Encryption Scope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): - Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", - "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, - Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeState - :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modification date and time of the encryption scope in - UTC. - :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a - required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: - ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, - 'require_infrastructure_encryption': {'key': 'properties.requireInfrastructureEncryption', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScope, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.state = kwargs.get('state', None) - self.creation_time = None - self.last_modified_time = None - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - - -class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): - """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_uri: The object identifier for a key vault key object. When applied, the encryption - scope will use the key referenced by the identifier to enable customer-managed key support on - this encryption scope. - :type key_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class EncryptionScopeListResult(msrest.serialization.Model): - """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of encryption scopes requested. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.EncryptionScope] - :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned - when total number of requested encryption scopes exceeds the maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type - implies that an account-scoped encryption key will be used. 'Service' key type implies that a - default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_01_01.models.KeyType - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - self.key_type = kwargs.get('key_type', None) - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = kwargs.get('table', None) - self.queue = kwargs.get('queue', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: - ~azure.mgmt.storage.v2021_01_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: - ~azure.mgmt.storage.v2021_01_01.models.StorageAccountInternetEndpoints - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, - 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - self.microsoft_endpoints = kwargs.get('microsoft_endpoints', None) - self.internet_endpoints = kwargs.get('internet_endpoints', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the storage resource provider. - - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_01_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body contract. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExtendedLocation(msrest.serialization.Model): - """The complex type of the extended location. - - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocationTypes - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: - ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_01_01.models.ProtocolSettings - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'protocol_settings': {'key': 'properties.protocolSettings', 'type': 'ProtocolSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.share_delete_retention_policy = kwargs.get('share_delete_retention_policy', None) - self.protocol_settings = kwargs.get('protocol_settings', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.snapshot_time = None - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.snapshot_time = None - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2021_01_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM - resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, - ~azure.mgmt.storage.v2021_01_01.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': 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': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2021_01_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class LastAccessTimeTrackingPolicy(msrest.serialization.Model): - """The blob service properties for Last access time based tracking policy. - - All required parameters must be populated in order to send to Azure. - - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently - read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_01_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in - days, typically how often the blob object should be tracked.This field is currently read only - with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported - value. This field is currently read only. - :type blob_type: list[str] - """ - - _validation = { - 'enable': {'required': True}, - } - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, - 'blob_type': {'key': 'blobType', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) - self.enable = kwargs['enable'] - self.name = kwargs.get('name', None) - self.tracking_granularity_in_days = kwargs.get('tracking_granularity_in_days', None) - self.blob_type = kwargs.get('blob_type', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_01_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListBlobInventoryPolicy(msrest.serialization.Model): - """List of blob inventory policies returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob inventory policies. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListBlobInventoryPolicy, self).__init__(**kwargs) - self.value = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_01_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueue(Resource): - """ListQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - - -class ListQueueResource(msrest.serialization.Model): - """Response schema. Contains list of queues returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queues returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.ListQueue] - :ivar next_link: Request URL that can be used to list next page of queues. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueueServices(msrest.serialization.Model): - """ListQueueServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queue services returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.QueueServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueServices, self).__init__(**kwargs) - self.value = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ListTableResource(msrest.serialization.Model): - """Response schema. Contains list of tables returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of tables returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.Table] - :ivar next_link: Request URL that can be used to query next page of tables. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Table]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListTableServices(msrest.serialization.Model): - """ListTableServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of table services returned. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.TableServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableServices, self).__init__(**kwargs) - self.value = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyVersion - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - self.version = kwargs.get('version', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - self.enable_auto_tier_to_hot_from_cool = kwargs.get('enable_auto_tier_to_hot_from_cool', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports - all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag - filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_01_01.models.TagFilter] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.blob_index_match = kwargs.get('blob_index_match', None) - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyVersion(msrest.serialization.Model): - """Management policy action for blob version. - - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob - version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyVersion, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_01_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class Multichannel(msrest.serialization.Model): - """Multichannel setting. Applies to Premium FileStorage only. - - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Multichannel, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_01_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_01_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_01_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_01_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_01_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'resource_access_rules': {'key': 'resourceAccessRules', 'type': '[ResourceAccessRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.resource_access_rules = kwargs.get('resource_access_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class ObjectReplicationPolicies(msrest.serialization.Model): - """List storage account object replication policies. - - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicies, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ObjectReplicationPolicy(Resource): - """The replication policy between two storage accounts. Multiple rules can be defined in one policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar policy_id: A unique id for object replication policy. - :vartype policy_id: str - :ivar enabled_time: Indicates when the policy is enabled on the source account. - :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyRule] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, - 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, - 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicy, self).__init__(**kwargs) - self.policy_id = None - self.enabled_time = None - self.source_account = kwargs.get('source_account', None) - self.destination_account = kwargs.get('destination_account', None) - self.rules = kwargs.get('rules', None) - - -class ObjectReplicationPolicyFilter(msrest.serialization.Model): - """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin - with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.min_creation_time = kwargs.get('min_creation_time', None) - - -class ObjectReplicationPolicyRule(msrest.serialization.Model): - """The replication policy rule between two containers. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is - required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyFilter - """ - - _validation = { - 'source_container': {'required': True}, - 'destination_container': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'source_container': {'key': 'sourceContainer', 'type': 'str'}, - 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyRule, self).__init__(**kwargs) - self.rule_id = kwargs.get('rule_id', None) - self.source_container = kwargs['source_container'] - self.destination_container = kwargs['destination_container'] - self.filters = kwargs.get('filters', None) - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_01_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_01_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :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(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storage.v2021_01_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type action_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class ProtocolSettings(msrest.serialization.Model): - """Protocol settings for file service. - - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_01_01.models.SmbSetting - """ - - _attribute_map = { - 'smb': {'key': 'smb', 'type': 'SmbSetting'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtocolSettings, self).__init__(**kwargs) - self.smb = kwargs.get('smb', None) - - -class QueueServiceProperties(Resource): - """The properties of a storage account’s Queue service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(QueueServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class ResourceAccessRule(msrest.serialization.Model): - """Resource Access Rule. - - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceAccessRule, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.resource_id = kwargs.get('resource_id', None) - - -class RestorePolicyProperties(msrest.serialization.Model): - """The blob service properties for blob restore policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than - DeleteRetentionPolicy.days. - :type days: int - :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. - :vartype last_enabled_time: ~datetime.datetime - :ivar min_restore_time: Returns the minimum date and time that the restore can be started. - :vartype min_restore_time: ~datetime.datetime - """ - - _validation = { - 'enabled': {'required': True}, - 'days': {'maximum': 365, 'minimum': 1}, - 'last_enabled_time': {'readonly': True}, - 'min_restore_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePolicyProperties, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs.get('days', None) - self.last_enabled_time = None - self.min_restore_time = None - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_01_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class RoutingPreference(msrest.serialization.Model): - """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. - Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_01_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing - storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing - storage endpoints are to be published. - :type publish_internet_endpoints: bool - """ - - _attribute_map = { - 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, - 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, - 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingPreference, self).__init__(**kwargs) - self.routing_choice = kwargs.get('routing_choice', None) - self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) - self.publish_internet_endpoints = kwargs.get('publish_internet_endpoints', None) - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_01_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_01_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuInformation(msrest.serialization.Model): - """Storage SKU and its 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. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_01_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2021_01_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_01_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SmbSetting(msrest.serialization.Model): - """Setting for SMB protocol. - - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_01_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, - SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are - NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values - are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are - AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str - """ - - _attribute_map = { - 'multichannel': {'key': 'multichannel', 'type': 'Multichannel'}, - 'versions': {'key': 'versions', 'type': 'str'}, - 'authentication_methods': {'key': 'authenticationMethods', 'type': 'str'}, - 'kerberos_ticket_encryption': {'key': 'kerberosTicketEncryption', 'type': 'str'}, - 'channel_encryption': {'key': 'channelEncryption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SmbSetting, self).__init__(**kwargs) - self.multichannel = kwargs.get('multichannel', None) - self.versions = kwargs.get('versions', None) - self.authentication_methods = kwargs.get('authentication_methods', None) - self.kerberos_ticket_encryption = kwargs.get('kerberos_ticket_encryption', None) - self.channel_encryption = kwargs.get('channel_encryption', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_01_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_01_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2021_01_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2021_01_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2021_01_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2021_01_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_01_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage account. - :vartype private_endpoint_connections: - list[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference - :ivar blob_restore_status: Blob restore status. - :vartype blob_restore_status: ~azure.mgmt.storage.v2021_01_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'blob_restore_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.extended_location = kwargs.get('extended_location', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.private_endpoint_connections = None - self.routing_preference = kwargs.get('routing_preference', None) - self.blob_restore_status = None - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the - storage account will be created in Azure main region. Otherwise it will be created in the - specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_01_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.extended_location = kwargs.get('extended_location', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - - -class StorageAccountInternetEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountInternetEndpoints, self).__init__(**kwargs) - self.blob = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2021_01_01.models.KeyPermission - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2021_01_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_01_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageQueue(Resource): - """StorageQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - :ivar approximate_message_count: Integer indicating an approximate number of messages in the - queue. This number is not lower than the actual number of messages in the queue, but could be - higher. - :vartype approximate_message_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'approximate_message_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - self.approximate_message_count = None - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.SkuInformation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_01_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_01_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Table(Resource): - """Properties of the table, including Id, resource name, resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar table_name: Table name under the specified account. - :vartype table_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'table_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Table, self).__init__(**kwargs) - self.table_name = None - - -class TableServiceProperties(Resource): - """The properties of a storage account’s Table service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(TableServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class TagFilter(msrest.serialization.Model): - """Blob index tag based filtering for blob objects. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and - filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can - have 0 - 256 characters. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 128, 'min_length': 1}, - 'op': {'required': True}, - 'value': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'op': {'key': 'op', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagFilter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.op = kwargs['op'] - self.value = kwargs['value'] - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2021_01_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2021_01_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the identity. - :vartype principal_id: str - :ivar client_id: The client ID of the identity. - :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(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_01_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py index ce32c8537084..f543a33f3837 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py @@ -20,31 +20,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_01_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2021_01_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -78,6 +78,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2021_01_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -94,19 +122,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -138,6 +166,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -178,6 +222,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -219,6 +265,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -228,12 +276,12 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2021_01_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2021_01_01.models.ActiveDirectoryProperties """ @@ -253,6 +301,15 @@ def __init__( active_directory_properties: Optional["ActiveDirectoryProperties"] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2021_01_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2021_01_01.models.ActiveDirectoryProperties + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -281,15 +338,15 @@ class BlobContainer(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -301,8 +358,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyProperties @@ -370,6 +427,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.version = None self.deleted = None @@ -406,9 +476,8 @@ class BlobInventoryPolicy(Resource): :vartype system_data: ~azure.mgmt.storage.v2021_01_01.models.SystemData :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicySchema + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicySchema """ _validation = { @@ -434,6 +503,11 @@ def __init__( policy: Optional["BlobInventoryPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicySchema + """ super(BlobInventoryPolicy, self).__init__(**kwargs) self.system_data = None self.last_modified_time = None @@ -445,8 +519,8 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyFilter + :ivar filters: Required. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyFilter """ _validation = { @@ -463,6 +537,10 @@ def __init__( filters: "BlobInventoryPolicyFilter", **kwargs ): + """ + :keyword filters: Required. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyFilter + """ super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) self.filters = filters @@ -472,15 +550,15 @@ class BlobInventoryPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value set to true. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :vartype include_snapshots: bool """ _validation = { @@ -503,6 +581,18 @@ def __init__( include_snapshots: Optional[bool] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Valid values include + blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value set to + true. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :paramtype include_snapshots: bool + """ super(BlobInventoryPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -515,13 +605,13 @@ class BlobInventoryPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyDefinition + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyDefinition """ _validation = { @@ -544,6 +634,15 @@ def __init__( definition: "BlobInventoryPolicyDefinition", **kwargs ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyDefinition + """ super(BlobInventoryPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -555,16 +654,16 @@ class BlobInventoryPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar destination: Required. Container name where blob inventory files are stored. Must be pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied + :vartype destination: str + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2021_01_01.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyRule] """ _validation = { @@ -590,6 +689,18 @@ def __init__( rules: List["BlobInventoryPolicyRule"], **kwargs ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2021_01_01.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyRule] + """ super(BlobInventoryPolicySchema, self).__init__(**kwargs) self.enabled = enabled self.destination = destination @@ -602,10 +713,10 @@ class BlobRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreRange] + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreRange] """ _validation = { @@ -625,6 +736,12 @@ def __init__( blob_ranges: List["BlobRestoreRange"], **kwargs ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreRange] + """ super(BlobRestoreParameters, self).__init__(**kwargs) self.time_to_restore = time_to_restore self.blob_ranges = blob_ranges @@ -635,10 +752,10 @@ class BlobRestoreRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str """ _validation = { @@ -658,6 +775,12 @@ def __init__( end_range: str, **kwargs ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ super(BlobRestoreRange, self).__init__(**kwargs) self.start_range = start_range self.end_range = end_range @@ -699,6 +822,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -727,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -746,31 +873,30 @@ class BlobServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_01_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_01_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2021_01_01.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2021_01_01.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: ~azure.mgmt.storage.v2021_01_01.models.LastAccessTimeTrackingPolicy """ @@ -811,6 +937,36 @@ def __init__( last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2021_01_01.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: ~azure.mgmt.storage.v2021_01_01.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2021_01_01.models.LastAccessTimeTrackingPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -827,12 +983,12 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - :type retention_in_days: int + :vartype retention_in_days: int """ _validation = { @@ -851,6 +1007,14 @@ def __init__( retention_in_days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled self.retention_in_days = retention_in_days @@ -889,6 +1053,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -898,17 +1064,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_01_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_01_01.models.CloudErrorBody] """ _attribute_map = { @@ -927,6 +1093,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_01_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -939,22 +1118,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2021_01_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -983,6 +1162,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2021_01_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -994,9 +1191,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2021_01_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2021_01_01.models.CorsRule] """ _attribute_map = { @@ -1009,6 +1206,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2021_01_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -1018,12 +1220,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -1042,6 +1244,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -1052,9 +1262,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -1071,6 +1281,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -1078,13 +1293,13 @@ def __init__( class DateAfterModification(msrest.serialization.Model): """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - :param days_after_modification_greater_than: Value indicating the age in days after last + :ivar days_after_modification_greater_than: Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy. - :type days_after_last_access_time_greater_than: float + :vartype days_after_last_access_time_greater_than: float """ _validation = { @@ -1104,6 +1319,15 @@ def __init__( days_after_last_access_time_greater_than: Optional[float] = None, **kwargs ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than @@ -1140,6 +1364,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1195,6 +1421,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1229,6 +1457,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1239,12 +1469,12 @@ class DeletedShare(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str """ _validation = { @@ -1264,6 +1494,14 @@ def __init__( deleted_share_version: str, **kwargs ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ super(DeletedShare, self).__init__(**kwargs) self.deleted_share_name = deleted_share_name self.deleted_share_version = deleted_share_version @@ -1272,11 +1510,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -1295,6 +1533,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1303,10 +1548,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1321,6 +1566,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1331,19 +1582,19 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_01_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2021_01_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_01_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :vartype key_source: str or ~azure.mgmt.storage.v2021_01_01.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_01_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_01_01.models.EncryptionIdentity + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_01_01.models.KeyVaultProperties + :ivar encryption_identity: The identity to be used with service-side encryption at rest. + :vartype encryption_identity: ~azure.mgmt.storage.v2021_01_01.models.EncryptionIdentity """ _validation = { @@ -1368,6 +1619,21 @@ def __init__( encryption_identity: Optional["EncryptionIdentity"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2021_01_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2021_01_01.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2021_01_01.models.KeyVaultProperties + :keyword encryption_identity: The identity to be used with service-side encryption at rest. + :paramtype encryption_identity: ~azure.mgmt.storage.v2021_01_01.models.EncryptionIdentity + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -1379,9 +1645,9 @@ def __init__( class EncryptionIdentity(msrest.serialization.Model): """Encryption identity for the storage account. - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str + :ivar encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to be + associated with server-side encryption on the storage account. + :vartype encryption_user_assigned_identity: str """ _attribute_map = { @@ -1394,6 +1660,11 @@ def __init__( encryption_user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to + be associated with server-side encryption on the storage account. + :paramtype encryption_user_assigned_identity: str + """ super(EncryptionIdentity, self).__init__(**kwargs) self.encryption_user_assigned_identity = encryption_user_assigned_identity @@ -1411,25 +1682,25 @@ class EncryptionScope(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + :vartype source: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeState + :vartype state: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeState :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. :vartype creation_time: ~datetime.datetime :ivar last_modified_time: Gets the last modification date and time of the encryption scope in UTC. :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool + :vartype require_infrastructure_encryption: bool """ _validation = { @@ -1461,6 +1732,22 @@ def __init__( require_infrastructure_encryption: Optional[bool] = None, **kwargs ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeKeyVaultProperties + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + """ super(EncryptionScope, self).__init__(**kwargs) self.source = source self.state = state @@ -1475,10 +1762,10 @@ class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_uri: The object identifier for a key vault key object. When applied, the encryption + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - :type key_uri: str + :vartype key_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -1503,6 +1790,12 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri self.current_versioned_key_identifier = None @@ -1535,6 +1828,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1545,17 +1840,17 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_01_01.models.KeyType + :vartype key_type: str or ~azure.mgmt.storage.v2021_01_01.models.KeyType """ _validation = { @@ -1575,6 +1870,15 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2021_01_01.models.KeyType + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -1584,14 +1888,14 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService """ _attribute_map = { @@ -1610,6 +1914,16 @@ def __init__( queue: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2021_01_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -1634,11 +1948,11 @@ class Endpoints(msrest.serialization.Model): :vartype web: str :ivar dfs: Gets the dfs endpoint. :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountInternetEndpoints """ @@ -1669,6 +1983,14 @@ def __init__( internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, **kwargs ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2021_01_01.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2021_01_01.models.StorageAccountInternetEndpoints + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -1683,8 +2005,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the storage resource provider. - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_01_01.models.ErrorResponseBody + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2021_01_01.models.ErrorResponseBody """ _attribute_map = { @@ -1697,6 +2019,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2021_01_01.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1704,12 +2030,12 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body contract. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1724,6 +2050,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1732,10 +2066,10 @@ def __init__( class ExtendedLocation(msrest.serialization.Model): """The complex type of the extended location. - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -1750,6 +2084,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -1776,6 +2116,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1795,15 +2137,15 @@ class FileServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: + :vartype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_01_01.models.ProtocolSettings + :ivar protocol_settings: Protocol settings for file service. + :vartype protocol_settings: ~azure.mgmt.storage.v2021_01_01.models.ProtocolSettings """ _validation = { @@ -1831,6 +2173,17 @@ def __init__( protocol_settings: Optional["ProtocolSettings"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2021_01_01.models.DeleteRetentionPolicy + :keyword protocol_settings: Protocol settings for file service. + :paramtype protocol_settings: ~azure.mgmt.storage.v2021_01_01.models.ProtocolSettings + """ super(FileServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -1855,17 +2208,17 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1874,10 +2227,10 @@ class FileShare(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -1938,6 +2291,23 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1972,17 +2342,17 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1991,10 +2361,10 @@ class FileShareItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2055,6 +2425,23 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_01_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_01_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.ShareAccessTier + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2098,6 +2485,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2141,6 +2530,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2158,13 +2549,13 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", + :ivar type: Required. The identity type. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM + :vartype type: str or ~azure.mgmt.storage.v2021_01_01.models.IdentityType + :ivar user_assigned_identities: Gets or sets a list of key value pairs that describe the set of + User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.storage.v2021_01_01.models.UserAssignedIdentity] """ @@ -2188,6 +2579,16 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: Required. The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.storage.v2021_01_01.models.IdentityType + :keyword user_assigned_identities: Gets or sets a list of key value pairs that describe the set + of User Assigned identities that will be used with this storage account. The key is the ARM + resource identifier of the identity. Only 1 User Assigned identity is permitted here. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.storage.v2021_01_01.models.UserAssignedIdentity] + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2210,18 +2611,18 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2249,6 +2650,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -2264,18 +2676,18 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2021_01_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2299,6 +2711,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -2312,12 +2735,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -2336,6 +2759,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -2346,12 +2777,12 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -2380,6 +2811,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2393,18 +2832,18 @@ class LastAccessTimeTrackingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_01_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in + :vartype name: str or ~azure.mgmt.storage.v2021_01_01.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only. - :type blob_type: list[str] + :vartype blob_type: list[str] """ _validation = { @@ -2427,6 +2866,20 @@ def __init__( blob_type: Optional[List[str]] = None, **kwargs ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2021_01_01.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) self.enable = enable self.name = name @@ -2439,20 +2892,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2477,6 +2930,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2488,11 +2957,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2507,6 +2976,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2524,9 +3000,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -2545,6 +3021,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2560,8 +3041,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_01_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2021_01_01.models.TagProperty] """ _validation = { @@ -2579,6 +3060,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2021_01_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2605,6 +3090,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2630,6 +3117,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2657,15 +3146,15 @@ class ListContainerItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -2677,8 +3166,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicyProperties @@ -2746,6 +3235,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_01_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.version = None self.deleted = None @@ -2791,6 +3293,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2809,8 +3313,8 @@ class ListQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] """ _validation = { @@ -2832,6 +3336,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = metadata @@ -2861,6 +3369,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2887,6 +3397,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2912,6 +3424,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2941,6 +3455,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2967,6 +3483,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2986,9 +3504,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySchema """ _validation = { @@ -3012,6 +3530,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -3020,12 +3543,12 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyVersion + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyVersion """ _attribute_map = { @@ -3042,6 +3565,14 @@ def __init__( version: Optional["ManagementPolicyVersion"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyVersion + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -3051,18 +3582,17 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool """ _attribute_map = { @@ -3081,6 +3611,20 @@ def __init__( enable_auto_tier_to_hot_from_cool: Optional[bool] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3093,10 +3637,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyFilter """ _validation = { @@ -3115,6 +3659,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -3125,14 +3675,14 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_01_01.models.TagFilter] + :vartype blob_index_match: list[~azure.mgmt.storage.v2021_01_01.models.TagFilter] """ _validation = { @@ -3153,6 +3703,16 @@ def __init__( blob_index_match: Optional[List["TagFilter"]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2021_01_01.models.TagFilter] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -3164,15 +3724,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_01_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2021_01_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyDefinition """ _validation = { @@ -3197,6 +3757,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2021_01_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -3209,9 +3780,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyRule] """ _validation = { @@ -3228,6 +3799,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -3235,14 +3811,14 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation """ _attribute_map = { @@ -3259,6 +3835,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3268,14 +3854,14 @@ def __init__( class ManagementPolicyVersion(msrest.serialization.Model): """Management policy action for blob version. - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation """ _attribute_map = { @@ -3292,6 +3878,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2021_01_01.models.DateAfterCreation + """ super(ManagementPolicyVersion, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3301,24 +3897,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_01_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2021_01_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -3347,6 +3943,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2021_01_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3362,8 +3978,8 @@ def __init__( class Multichannel(msrest.serialization.Model): """Multichannel setting. Applies to Premium FileStorage only. - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -3376,6 +3992,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = enabled @@ -3385,20 +4005,20 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_01_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_01_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_01_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_01_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2021_01_01.models.Bypass + :ivar resource_access_rules: Sets the resource access rules. + :vartype resource_access_rules: list[~azure.mgmt.storage.v2021_01_01.models.ResourceAccessRule] + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2021_01_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2021_01_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_01_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2021_01_01.models.DefaultAction """ _validation = { @@ -3423,6 +4043,24 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2021_01_01.models.Bypass + :keyword resource_access_rules: Sets the resource access rules. + :paramtype resource_access_rules: + list[~azure.mgmt.storage.v2021_01_01.models.ResourceAccessRule] + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2021_01_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2021_01_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2021_01_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.resource_access_rules = resource_access_rules @@ -3434,8 +4072,8 @@ def __init__( class ObjectReplicationPolicies(msrest.serialization.Model): """List storage account object replication policies. - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy] + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy] """ _attribute_map = { @@ -3448,6 +4086,10 @@ def __init__( value: Optional[List["ObjectReplicationPolicy"]] = None, **kwargs ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy] + """ super(ObjectReplicationPolicies, self).__init__(**kwargs) self.value = value @@ -3469,12 +4111,12 @@ class ObjectReplicationPolicy(Resource): :vartype policy_id: str :ivar enabled_time: Indicates when the policy is enabled on the source account. :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyRule] + :ivar source_account: Required. Source account name. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyRule] """ _validation = { @@ -3504,6 +4146,14 @@ def __init__( rules: Optional[List["ObjectReplicationPolicyRule"]] = None, **kwargs ): + """ + :keyword source_account: Required. Source account name. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: list[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyRule] + """ super(ObjectReplicationPolicy, self).__init__(**kwargs) self.policy_id = None self.enabled_time = None @@ -3515,12 +4165,12 @@ def __init__( class ObjectReplicationPolicyFilter(msrest.serialization.Model): """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str """ _attribute_map = { @@ -3535,6 +4185,14 @@ def __init__( min_creation_time: Optional[str] = None, **kwargs ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.min_creation_time = min_creation_time @@ -3545,15 +4203,15 @@ class ObjectReplicationPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyFilter + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyFilter """ _validation = { @@ -3577,6 +4235,17 @@ def __init__( filters: Optional["ObjectReplicationPolicyFilter"] = None, **kwargs ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicyFilter + """ super(ObjectReplicationPolicyRule, self).__init__(**kwargs) self.rule_id = rule_id self.source_container = source_container @@ -3587,14 +4256,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_01_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_01_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2021_01_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2021_01_01.models.ServiceSpecification """ _attribute_map = { @@ -3613,6 +4282,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2021_01_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2021_01_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3623,14 +4302,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -3649,6 +4328,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3659,8 +4348,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.Operation] """ _attribute_map = { @@ -3673,6 +4362,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2021_01_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -3698,6 +4391,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3715,11 +4410,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storage.v2021_01_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -3750,6 +4445,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2021_01_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -3759,8 +4462,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection] """ _attribute_map = { @@ -3773,6 +4476,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -3794,8 +4501,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -3821,6 +4528,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -3830,8 +4541,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateLinkResource] """ _attribute_map = { @@ -3844,6 +4555,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2021_01_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -3851,15 +4566,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -3876,6 +4591,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -3885,8 +4611,8 @@ def __init__( class ProtocolSettings(msrest.serialization.Model): """Protocol settings for file service. - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_01_01.models.SmbSetting + :ivar smb: Setting for SMB protocol. + :vartype smb: ~azure.mgmt.storage.v2021_01_01.models.SmbSetting """ _attribute_map = { @@ -3899,6 +4625,10 @@ def __init__( smb: Optional["SmbSetting"] = None, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_01_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = smb @@ -3916,10 +4646,10 @@ class QueueServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules """ _validation = { @@ -3941,6 +4671,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + """ super(QueueServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -3948,10 +4684,10 @@ def __init__( class ResourceAccessRule(msrest.serialization.Model): """Resource Access Rule. - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar resource_id: Resource Id. + :vartype resource_id: str """ _attribute_map = { @@ -3966,6 +4702,12 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ super(ResourceAccessRule, self).__init__(**kwargs) self.tenant_id = tenant_id self.resource_id = resource_id @@ -3978,11 +4720,11 @@ class RestorePolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than + :ivar enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - :type days: int + :vartype days: int :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. :vartype last_enabled_time: ~datetime.datetime :ivar min_restore_time: Returns the minimum date and time that the restore can be started. @@ -4010,6 +4752,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -4027,11 +4776,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_01_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2021_01_01.models.ReasonCode """ _validation = { @@ -4051,6 +4800,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2021_01_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -4060,15 +4816,15 @@ def __init__( class RoutingPreference(msrest.serialization.Model): """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_01_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + :vartype routing_choice: str or ~azure.mgmt.storage.v2021_01_01.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing storage endpoints are to be published. - :type publish_internet_endpoints: bool + :vartype publish_internet_endpoints: bool """ _attribute_map = { @@ -4085,6 +4841,17 @@ def __init__( publish_internet_endpoints: Optional[bool] = None, **kwargs ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2021_01_01.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ super(RoutingPreference, self).__init__(**kwargs) self.routing_choice = routing_choice self.publish_microsoft_endpoints = publish_microsoft_endpoints @@ -4096,49 +4863,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -4190,6 +4956,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2021_01_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_01_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_01_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -4214,8 +5026,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_01_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2021_01_01.models.MetricSpecification] """ _attribute_map = { @@ -4228,6 +5041,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2021_01_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4239,11 +5057,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_01_01.models.SkuTier @@ -4265,6 +5083,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4296,6 +5121,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4308,11 +5135,11 @@ class SkuInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_01_01.models.SkuTier @@ -4327,9 +5154,9 @@ class SkuInformation(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2021_01_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_01_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2021_01_01.models.Restriction] """ _validation = { @@ -4358,6 +5185,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_01_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2021_01_01.models.Restriction] + """ super(SkuInformation, self).__init__(**kwargs) self.name = name self.tier = None @@ -4371,20 +5208,20 @@ def __init__( class SmbSetting(msrest.serialization.Model): """Setting for SMB protocol. - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_01_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + :ivar multichannel: Multichannel setting. Applies to Premium FileStorage only. + :vartype multichannel: ~azure.mgmt.storage.v2021_01_01.models.Multichannel + :ivar versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are + :vartype versions: str + :ivar authentication_methods: SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values + :vartype authentication_methods: str + :ivar kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are + :vartype kerberos_ticket_encryption: str + :ivar channel_encryption: SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str + :vartype channel_encryption: str """ _attribute_map = { @@ -4405,6 +5242,22 @@ def __init__( channel_encryption: Optional[str] = None, **kwargs ): + """ + :keyword multichannel: Multichannel setting. Applies to Premium FileStorage only. + :paramtype multichannel: ~azure.mgmt.storage.v2021_01_01.models.Multichannel + :keyword versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + SMB3.1.1. Should be passed as a string with delimiter ';'. + :paramtype versions: str + :keyword authentication_methods: SMB authentication methods supported by server. Valid values + are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + :paramtype authentication_methods: str + :keyword kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid + values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. + :paramtype kerberos_ticket_encryption: str + :keyword channel_encryption: SMB channel encryption supported by server. Valid values are + AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + :paramtype channel_encryption: str + """ super(SmbSetting, self).__init__(**kwargs) self.multichannel = multichannel self.versions = versions @@ -4428,10 +5281,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -4456,6 +5309,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -4476,19 +5335,19 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_01_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_01_01.models.Identity + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_01_01.models.ProvisioningState @@ -4527,48 +5386,48 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_01_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState :ivar private_endpoint_connections: List of private endpoint connection associated with the specified storage account. :vartype private_endpoint_connections: list[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference + :vartype routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference :ivar blob_restore_status: Blob restore status. :vartype blob_restore_status: ~azure.mgmt.storage.v2021_01_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool """ _validation = { @@ -4653,6 +5512,46 @@ def __init__( enable_nfs_v3: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_01_01.models.Identity + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -4693,8 +5592,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -4718,6 +5617,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -4727,69 +5630,69 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the + :vartype location: str + :ivar extended_location: Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_01_01.models.Identity - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_01_01.models.Identity + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool """ _validation = { @@ -4844,6 +5747,71 @@ def __init__( enable_nfs_v3: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword extended_location: Optional. Set the extended location of the resource. If not set, + the storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :paramtype extended_location: ~azure.mgmt.storage.v2021_01_01.models.ExtendedLocation + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_01_01.models.Identity + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -4899,6 +5867,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4936,6 +5906,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4964,6 +5936,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4994,6 +5968,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5040,6 +6016,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -5054,9 +6032,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -5073,6 +6051,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -5080,58 +6063,57 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_01_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_01_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_01_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _attribute_map = { @@ -5172,6 +6154,61 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2021_01_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_01_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_01_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_01_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2021_01_01.models.Encryption + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_01_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_01_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_01_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_01_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_01_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_01_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -5203,8 +6240,8 @@ class StorageQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] :ivar approximate_message_count: Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. @@ -5232,6 +6269,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = metadata self.approximate_message_count = None @@ -5258,6 +6299,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5265,20 +6308,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_01_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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.storage.v2021_01_01.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". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_01_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.storage.v2021_01_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -5301,6 +6344,22 @@ def __init__( 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.storage.v2021_01_01.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.storage.v2021_01_01.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 @@ -5345,6 +6404,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5362,10 +6423,10 @@ class TableServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules """ _validation = { @@ -5387,6 +6448,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2021_01_01.models.CorsRules + """ super(TableServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -5396,14 +6463,14 @@ class TagFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters. - :type value: str + :vartype value: str """ _validation = { @@ -5426,6 +6493,16 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ super(TagFilter, self).__init__(**kwargs) self.name = name self.op = op @@ -5469,6 +6546,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5521,6 +6600,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5564,6 +6645,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5574,8 +6657,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_01_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2021_01_01.models.Usage] """ _attribute_map = { @@ -5588,6 +6671,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2021_01_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -5617,6 +6704,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5647,6 +6736,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5657,15 +6748,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_01_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2021_01_01.models.State """ _validation = { @@ -5686,6 +6777,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2021_01_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py index bccc88e90fb0..38f7e753f257 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,11 +26,11 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class BlobInventoryPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. @@ -55,7 +40,7 @@ class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En COMPLETE = "Complete" FAILED = "Failed" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -66,7 +51,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -76,7 +61,7 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -85,14 +70,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -100,7 +85,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication protocol that is used for the file share. Can only be specified when creating a share. """ @@ -108,7 +93,7 @@ class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SMB = "SMB" NFS = "NFS" -class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. """ @@ -116,20 +101,20 @@ class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class EncryptionScopeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -141,14 +126,14 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -157,14 +142,14 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -173,20 +158,20 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class InventoryRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Inventory """ INVENTORY = "Inventory" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -194,7 +179,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. @@ -203,7 +188,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE = "Service" ACCOUNT = "Account" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -213,14 +198,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -230,7 +215,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -238,7 +223,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -248,27 +233,27 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ListContainersInclude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" -class ListSharesExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListSharesExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" SNAPSHOTS = "snapshots" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -277,13 +262,13 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only """ ACCESS_TIME_TRACKING = "AccessTimeTracking" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -297,7 +282,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -306,7 +291,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -314,7 +299,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -322,7 +307,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -330,11 +315,11 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class PutSharesExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PutSharesExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SNAPSHOTS = "snapshots" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -342,7 +327,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -352,7 +337,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The property is for NFS share only. The default is NoRootSquash. """ @@ -360,20 +345,20 @@ class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class RoutingChoice(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Routing Choice defines the kind of network routing opted by the user. """ MICROSOFT_ROUTING = "MicrosoftRouting" INTERNET_ROUTING = "InternetRouting" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -383,7 +368,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. """ @@ -393,7 +378,7 @@ class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" PREMIUM = "Premium" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -403,7 +388,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -413,7 +398,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -427,14 +412,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -444,12 +429,12 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class StorageAccountExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO_REPLICATION_STATS = "geoReplicationStats" BLOB_RESTORE_STATUS = "blobRestoreStatus" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py index 71f641b6641c..baed2e336681 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py @@ -5,23 +5,593 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,16 +615,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - include=None, # type: Optional[Union[str, "_models.ListContainersInclude"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -83,42 +653,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,20 +703,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -178,33 +746,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,17 +780,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -260,33 +820,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,16 +850,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -334,28 +886,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +911,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -403,26 +947,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,15 +971,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -472,33 +1009,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,17 +1039,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -550,33 +1079,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -590,18 +1109,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -634,40 +1155,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,23 +1185,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -723,32 +1234,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,23 +1256,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the @@ -806,31 +1307,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -840,23 +1329,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -886,29 +1378,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -918,24 +1400,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -969,37 +1454,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1009,23 +1484,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1053,36 +1531,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,4 +1564,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py index 7a270d56fc21..af6d91a90056 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +222,8 @@ def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy @@ -75,34 +234,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -111,17 +260,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - properties, # type: "_models.BlobInventoryPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Sets the blob inventory policy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -133,7 +284,8 @@ def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -146,39 +298,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -187,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: """Deletes the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -208,7 +352,8 @@ def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicyName :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 @@ -219,34 +364,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -254,13 +389,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListBlobInventoryPolicy"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -271,8 +407,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -280,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -322,12 +457,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py index 0d43959e0413..7a8fd808b1fe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-01-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -71,36 +192,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +236,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +273,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +302,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +333,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +357,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py index 2f9d2488b272..248413c7f014 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py @@ -5,23 +5,91 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + deleted_account_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}') + path_format_arguments = { + "deletedAccountName": _SERIALIZER.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,16 +113,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedAccountListResult"]: """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -62,34 +132,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,24 +167,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace def get( self, - deleted_account_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedAccount" + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": """Get properties of specified deleted account resource. :param deleted_account_name: Name of the deleted storage account. @@ -136,33 +202,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -171,4 +227,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py index cde30462cbeb..b6e6688d11a5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py @@ -5,23 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,15 +212,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. @@ -82,39 +249,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -127,17 +284,19 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. @@ -165,39 +324,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -206,16 +355,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": """Returns the properties for the specified encryption scope. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -240,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -276,15 +417,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionScopeListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: """Lists all the encryption scopes available under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -295,8 +438,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -304,36 +449,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,6 +493,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py index 373f185c9dd8..3d9d06fe5edf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-01-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py index cab0274a3518..62cba64ea9b4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py @@ -5,23 +5,297 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, "_models.ListSharesExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + expand: Optional[Union[str, "_models.PutSharesExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + 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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = "stats", + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +319,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - expand=None, # type: Optional[Union[str, "_models.ListSharesExpand"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, "_models.ListSharesExpand"]] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -82,42 +356,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,21 +406,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - expand=None, # type: Optional[Union[str, "_models.PutSharesExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[Union[str, "_models.PutSharesExpand"]] = None, + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -180,35 +452,24 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,17 +487,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -264,33 +527,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,18 +557,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - expand="stats", # type: Optional[str] - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = "stats", + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -330,7 +585,8 @@ def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. :type x_ms_snapshot: str @@ -344,32 +600,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -383,17 +627,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -420,30 +666,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -456,15 +691,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def restore( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - deleted_share, # type: "_models.DeletedShare" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: """Restore a file share within a valid retention days if share soft delete is enabled. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -491,33 +727,23 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -529,3 +755,4 @@ def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py index befa7fd77840..81af5a7e3d31 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py index 964e5a958d40..e2dd287e7239 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ObjectReplicationPolicies"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: """List the object replication policies associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Get the object replication policy of the storage account by policy ID. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -154,34 +312,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -190,17 +338,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - properties, # type: "_models.ObjectReplicationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Create or update the object replication policy of the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -226,39 +376,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -267,16 +407,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: """Deletes the object replication policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -299,37 +441,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py index c92895c524b0..34e67d1dbce8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2021_01_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py index bdc85a1e1b9b..0486de9f0726 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,17 +337,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -224,39 +374,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -265,16 +405,18 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -297,37 +439,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py index ad8ec33c6d05..7a77da0a4acf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +107,17 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +131,6 @@ def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py index e605d8fff924..5ab075bc68e3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): """QueueOperations operations. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -80,33 +291,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +321,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -157,33 +360,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,16 +390,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": """Gets the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -231,28 +426,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -266,16 +451,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -300,28 +487,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -334,15 +511,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListQueueResource"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: """Gets a list of all the queues under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -368,40 +546,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +594,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py index 7c996f220d57..7c4b937c73bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-01-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListQueueServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": """List all queue services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.QueueServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py index 05c57efc2e7e..ce8849bad2f6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py index 97ccc9fd067e..3efe58db5a4a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py @@ -5,25 +5,561 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +583,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_01_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.CheckNameAvailabilityResult @@ -69,30 +606,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +633,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +680,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +708,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_01_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +732,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +758,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +787,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +810,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -332,29 +844,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +869,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -406,32 +909,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,19 +938,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -465,34 +962,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +1002,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -528,8 +1021,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_01_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -537,35 +1032,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -583,19 +1074,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -606,7 +1098,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -618,29 +1111,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,16 +1136,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -675,7 +1159,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_01_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountListKeysResult @@ -686,32 +1171,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,16 +1200,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -756,32 +1233,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,16 +1262,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -826,32 +1295,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,39 +1324,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2021-01-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,13 +1362,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -930,15 +1383,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -952,21 +1407,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -978,47 +1426,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore def _restore_blob_ranges_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobRestoreStatus" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,16 +1474,18 @@ def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace def begin_restore_blob_ranges( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BlobRestoreStatus"] + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: """Restore blobs in the specified blob ranges. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1059,15 +1499,19 @@ def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_01_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) + :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 BlobRestoreStatus or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_01_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1079,27 +1523,21 @@ def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1111,15 +1549,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1139,25 +1578,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1169,3 +1600,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py index 57ada786cad4..2052e164ab9e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): """TableOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -76,28 +261,18 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,16 +286,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -144,28 +321,18 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,16 +346,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Gets the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -212,28 +381,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,16 +406,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -280,28 +441,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -314,13 +465,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListTableResource"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: """Gets a list of all the tables under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -340,36 +492,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -387,6 +536,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py index cc7fae88b319..8d957806f594 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-01-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): """TableServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListTableServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": """List all table services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.TableServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": """Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": """Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py index 580f3599ccfb..c1ff00f7a536 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py index 8b84770f1df9..4639f88f360f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json index f4dc9ffd9d4b..aa6f7acf22e6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py index 62bbd9818f24..ac503a61e234 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py @@ -6,42 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -55,17 +35,23 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_02_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_02_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_02_01.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_02_01.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_02_01.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_02_01.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_02_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_02_01.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_02_01.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_02_01.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_02_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_02_01.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_02_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_02_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -86,84 +72,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py index 842f8ada255d..16da1f3188df 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py index 84b8a89e6b31..fa820f3c5bd8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py @@ -6,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -47,27 +29,36 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2021_02_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2021_02_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2021_02_01.aio.operations.StorageAccountsOperations :ivar deleted_accounts: DeletedAccountsOperations operations - :vartype deleted_accounts: azure.mgmt.storage.v2021_02_01.aio.operations.DeletedAccountsOperations + :vartype deleted_accounts: + azure.mgmt.storage.v2021_02_01.aio.operations.DeletedAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_02_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_02_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_02_01.aio.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_02_01.aio.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_02_01.aio.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_02_01.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_02_01.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_02_01.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_02_01.aio.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_02_01.aio.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_02_01.aio.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_02_01.aio.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_02_01.aio.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_02_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2021_02_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2021_02_01.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations :vartype file_services: azure.mgmt.storage.v2021_02_01.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations @@ -84,82 +75,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py index 7773c9cb187e..21bc3f7f4d79 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2021_02_01.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -172,33 +178,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,8 +212,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -253,33 +252,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,8 +282,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -326,28 +318,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,8 +343,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,26 +379,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,6 +403,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -462,33 +441,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,8 +471,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -539,33 +511,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -579,8 +541,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -622,40 +587,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,14 +617,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -710,32 +666,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -745,14 +688,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -792,31 +739,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -826,14 +761,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -871,29 +810,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -903,14 +832,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -953,37 +886,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -993,14 +916,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1036,36 +963,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1079,4 +996,6 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py index 26347aabee8d..570b62d2e149 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -106,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -127,7 +127,8 @@ async def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,39 +141,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -181,8 +172,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,7 +195,8 @@ async def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName :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 @@ -212,34 +207,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -247,6 +232,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -263,8 +250,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -272,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -314,12 +300,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py index eac22724fa55..492456411dee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py index 493edc60ee1c..28d0cbf8f654 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._deleted_accounts_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,17 +100,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace_async async def get( self, deleted_account_name: str, @@ -130,33 +135,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -165,4 +160,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py index 8e4cfa289175..051c1d6e475a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def put( self, resource_group_name: str, @@ -77,39 +83,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -122,8 +118,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -159,39 +158,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -200,8 +189,11 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,34 +225,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -269,8 +251,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -287,8 +272,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -296,36 +283,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -343,6 +327,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py index b1a8c6fdfdca..50d1e18742a9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py index 28fdb0080068..4547bd16f533 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_restore_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list( :type expand: str or ~azure.mgmt.storage.v2021_02_01.models.ListSharesExpand :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -77,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +134,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -174,35 +180,24 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,8 +215,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -257,33 +255,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -297,8 +285,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -322,7 +313,8 @@ async def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. :type x_ms_snapshot: str @@ -336,32 +328,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,8 +355,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -411,30 +394,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -447,6 +419,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def restore( self, resource_group_name: str, @@ -481,33 +455,23 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -519,3 +483,4 @@ async def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py index 6ff754af14a1..e4f78432c2a8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py index 1cc042f1c30b..4697cb820a46 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -148,34 +155,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -184,8 +181,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -219,39 +219,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -260,8 +250,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -291,37 +284,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py index 4defdab67ac3..c4bb5dfc8069 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py index d35508c36cca..c49d1f31e791 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -217,39 +217,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -258,8 +248,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -289,37 +282,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py index b510330027ad..69ffbf500d31 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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_list_by_storage_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_account( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,4 +94,6 @@ async def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py index cfb603403b6e..d846b7c3ea8a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -75,33 +81,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +111,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -151,33 +150,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,8 +180,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,28 +216,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,8 +241,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -292,28 +277,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -326,6 +301,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -351,7 +328,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListQueueResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -359,40 +337,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -410,6 +385,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py index 916c0cb85c1d..41d3980c43ac 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueueServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py index 53e098893fa7..8f672833aa43 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py index e60dfe68b399..2e9cabb1509d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_02_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_02_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_02_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -323,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -396,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -445,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -516,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -593,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -605,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -661,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_02_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountListKeysResult @@ -672,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -741,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -810,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -862,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -893,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -912,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -934,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -960,6 +892,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore async def _restore_blob_ranges_initial( @@ -974,32 +907,22 @@ async def _restore_blob_ranges_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,8 +940,11 @@ async def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async async def begin_restore_blob_ranges( self, resource_group_name: str, @@ -1039,15 +965,20 @@ async def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_02_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1059,27 +990,21 @@ async def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1091,8 +1016,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -1118,25 +1045,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1148,3 +1067,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py index 6d851ce472df..f5489bfecfd2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -71,28 +77,18 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +102,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,28 +137,18 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,8 +162,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,28 +197,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +222,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -272,28 +257,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,6 +281,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -323,7 +300,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListTableResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -331,36 +309,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -378,6 +353,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py index fc661d2fd5d0..82a1b18b0dbd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -131,34 +129,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TableServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,8 +158,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -200,29 +189,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,4 +213,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py index 2f546eb90431..6d24b462b3c3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_02_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py index 70e4b5e2e463..684042857a02 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py @@ -6,270 +6,138 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobInventoryPolicy - from ._models_py3 import BlobInventoryPolicyDefinition - from ._models_py3 import BlobInventoryPolicyFilter - from ._models_py3 import BlobInventoryPolicyRule - from ._models_py3 import BlobInventoryPolicySchema - from ._models_py3 import BlobRestoreParameters - from ._models_py3 import BlobRestoreRange - from ._models_py3 import BlobRestoreStatus - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import DeletedAccount - from ._models_py3 import DeletedAccountListResult - from ._models_py3 import DeletedShare - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionIdentity - from ._models_py3 import EncryptionScope - from ._models_py3 import EncryptionScopeKeyVaultProperties - from ._models_py3 import EncryptionScopeListResult - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import ExtendedLocation - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import KeyCreationTime - from ._models_py3 import KeyPolicy - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LastAccessTimeTrackingPolicy - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListBlobInventoryPolicy - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListQueue - from ._models_py3 import ListQueueResource - from ._models_py3 import ListQueueServices - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ListTableResource - from ._models_py3 import ListTableServices - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import ManagementPolicyVersion - from ._models_py3 import MetricSpecification - from ._models_py3 import Multichannel - from ._models_py3 import NetworkRuleSet - from ._models_py3 import ObjectReplicationPolicies - from ._models_py3 import ObjectReplicationPolicy - from ._models_py3 import ObjectReplicationPolicyFilter - from ._models_py3 import ObjectReplicationPolicyRule - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProtocolSettings - from ._models_py3 import ProxyResource - from ._models_py3 import QueueServiceProperties - from ._models_py3 import Resource - from ._models_py3 import ResourceAccessRule - from ._models_py3 import RestorePolicyProperties - from ._models_py3 import Restriction - from ._models_py3 import RoutingPreference - from ._models_py3 import SKUCapability - from ._models_py3 import SasPolicy - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuInformation - from ._models_py3 import SmbSetting - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountInternetEndpoints - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountMicrosoftEndpoints - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageQueue - from ._models_py3 import StorageSkuListResult - from ._models_py3 import SystemData - from ._models_py3 import Table - from ._models_py3 import TableServiceProperties - from ._models_py3 import TagFilter - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import UserAssignedIdentity - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobInventoryPolicy # type: ignore - from ._models import BlobInventoryPolicyDefinition # type: ignore - from ._models import BlobInventoryPolicyFilter # type: ignore - from ._models import BlobInventoryPolicyRule # type: ignore - from ._models import BlobInventoryPolicySchema # type: ignore - from ._models import BlobRestoreParameters # type: ignore - from ._models import BlobRestoreRange # type: ignore - from ._models import BlobRestoreStatus # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import DeletedAccount # type: ignore - from ._models import DeletedAccountListResult # type: ignore - from ._models import DeletedShare # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionIdentity # type: ignore - from ._models import EncryptionScope # type: ignore - from ._models import EncryptionScopeKeyVaultProperties # type: ignore - from ._models import EncryptionScopeListResult # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import KeyCreationTime # type: ignore - from ._models import KeyPolicy # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LastAccessTimeTrackingPolicy # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListBlobInventoryPolicy # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListQueue # type: ignore - from ._models import ListQueueResource # type: ignore - from ._models import ListQueueServices # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ListTableResource # type: ignore - from ._models import ListTableServices # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import ManagementPolicyVersion # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import Multichannel # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import ObjectReplicationPolicies # type: ignore - from ._models import ObjectReplicationPolicy # type: ignore - from ._models import ObjectReplicationPolicyFilter # type: ignore - from ._models import ObjectReplicationPolicyRule # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProtocolSettings # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueueServiceProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceAccessRule # type: ignore - from ._models import RestorePolicyProperties # type: ignore - from ._models import Restriction # type: ignore - from ._models import RoutingPreference # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import SasPolicy # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SmbSetting # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountInternetEndpoints # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountMicrosoftEndpoints # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageQueue # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import Table # type: ignore - from ._models import TableServiceProperties # type: ignore - from ._models import TagFilter # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import UserAssignedIdentity # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedAccount +from ._models_py3 import DeletedAccountListResult +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionIdentity +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import KeyCreationTime +from ._models_py3 import KeyPolicy +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import Multichannel +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProtocolSettings +from ._models_py3 import ProxyResource +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceAccessRule +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import SasPolicy +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import SmbSetting +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models.py deleted file mode 100644 index 4dc29f6b362c..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models.py +++ /dev/null @@ -1,5404 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_02_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2021_02_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2021_02_01.models.ActiveDirectoryProperties - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_02_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class BlobInventoryPolicy(Resource): - """The storage account blob inventory policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.storage.v2021_02_01.models.SystemData - :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. - :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicy, self).__init__(**kwargs) - self.system_data = None - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class BlobInventoryPolicyDefinition(msrest.serialization.Model): - """An object that defines the blob inventory rule. Each definition consists of a set of filters. - - All required parameters must be populated in order to send to Azure. - - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyFilter - """ - - _validation = { - 'filters': {'required': True}, - } - - _attribute_map = { - 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) - self.filters = kwargs['filters'] - - -class BlobInventoryPolicyFilter(msrest.serialization.Model): - """An object that defines the blob inventory rule filter conditions. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, - 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.include_blob_versions = kwargs.get('include_blob_versions', None) - self.include_snapshots = kwargs.get('include_snapshots', None) - - -class BlobInventoryPolicyRule(msrest.serialization.Model): - """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyDefinition - """ - - _validation = { - 'enabled': {'required': True}, - 'name': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.name = kwargs['name'] - self.definition = kwargs['definition'] - - -class BlobInventoryPolicySchema(msrest.serialization.Model): - """The storage account blob inventory policy rules. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be - pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied - when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyRule] - """ - - _validation = { - 'enabled': {'required': True}, - 'destination': {'required': True}, - 'type': {'required': True}, - 'rules': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicySchema, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.destination = kwargs['destination'] - self.type = kwargs['type'] - self.rules = kwargs['rules'] - - -class BlobRestoreParameters(msrest.serialization.Model): - """Blob restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreRange] - """ - - _validation = { - 'time_to_restore': {'required': True}, - 'blob_ranges': {'required': True}, - } - - _attribute_map = { - 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, - 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreParameters, self).__init__(**kwargs) - self.time_to_restore = kwargs['time_to_restore'] - self.blob_ranges = kwargs['blob_ranges'] - - -class BlobRestoreRange(msrest.serialization.Model): - """Blob range. - - All required parameters must be populated in order to send to Azure. - - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str - """ - - _validation = { - 'start_range': {'required': True}, - 'end_range': {'required': True}, - } - - _attribute_map = { - 'start_range': {'key': 'startRange', 'type': 'str'}, - 'end_range': {'key': 'endRange', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreRange, self).__init__(**kwargs) - self.start_range = kwargs['start_range'] - self.end_range = kwargs['end_range'] - - -class BlobRestoreStatus(msrest.serialization.Model): - """Blob restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates - that blob restore is ongoing. - Complete: Indicates that blob restore has been completed - successfully. - Failed: Indicates that blob restore is failed. Possible values include: - "InProgress", "Complete", "Failed". - :vartype status: str or ~azure.mgmt.storage.v2021_02_01.models.BlobRestoreProgressStatus - :ivar failure_reason: Failure reason when blob restore is failed. - :vartype failure_reason: str - :ivar restore_id: Id for tracking blob restore request. - :vartype restore_id: str - :ivar parameters: Blob restore request parameters. - :vartype parameters: ~azure.mgmt.storage.v2021_02_01.models.BlobRestoreParameters - """ - - _validation = { - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'restore_id': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - 'restore_id': {'key': 'restoreId', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreStatus, self).__init__(**kwargs) - self.status = None - self.failure_reason = None - self.restore_id = None - self.parameters = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_02_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_02_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: - ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: - ~azure.mgmt.storage.v2021_02_01.models.LastAccessTimeTrackingPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, - 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.is_versioning_enabled = kwargs.get('is_versioning_enabled', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - self.restore_policy = kwargs.get('restore_policy', None) - self.container_delete_retention_policy = kwargs.get('container_delete_retention_policy', None) - self.last_access_time_tracking_policy = kwargs.get('last_access_time_tracking_policy', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value - is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite - retention of the change feed. - :type retention_in_days: int - """ - - _validation = { - 'retention_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.retention_in_days = kwargs.get('retention_in_days', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2021_02_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_02_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2021_02_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2021_02_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - - :param days_after_modification_greater_than: Value indicating the age in days after last - modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last - blob access. This property can only be used in conjunction with last access time tracking - policy. - :type days_after_last_access_time_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, - 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) - self.days_after_last_access_time_greater_than = kwargs.get('days_after_last_access_time_greater_than', None) - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class DeletedAccount(ProxyResource): - """Deleted storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar storage_account_resource_id: Full resource id of the original storage account. - :vartype storage_account_resource_id: str - :ivar location: Location of the deleted account. - :vartype location: str - :ivar restore_reference: Can be used to attempt recovering this deleted account via - PutStorageAccount API. - :vartype restore_reference: str - :ivar creation_time: Creation time of the deleted account. - :vartype creation_time: str - :ivar deletion_time: Deletion time of the deleted account. - :vartype deletion_time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'storage_account_resource_id': {'readonly': True}, - 'location': {'readonly': True}, - 'restore_reference': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'deletion_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'restore_reference': {'key': 'properties.restoreReference', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'deletion_time': {'key': 'properties.deletionTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccount, self).__init__(**kwargs) - self.storage_account_resource_id = None - self.location = None - self.restore_reference = None - self.creation_time = None - self.deletion_time = None - - -class DeletedAccountListResult(msrest.serialization.Model): - """The response from the List Deleted Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of deleted accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.DeletedAccount] - :ivar next_link: Request URL that can be used to query next page of deleted accounts. Returned - when total number of requested deleted accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DeletedShare(msrest.serialization.Model): - """The deleted share to be restored. - - All required parameters must be populated in order to send to Azure. - - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will - be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str - """ - - _validation = { - 'deleted_share_name': {'required': True}, - 'deleted_share_version': {'required': True}, - } - - _attribute_map = { - 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, - 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedShare, self).__init__(**kwargs) - self.deleted_share_name = kwargs['deleted_share_name'] - self.deleted_share_version = kwargs['deleted_share_version'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_02_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_02_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_02_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_02_01.models.EncryptionIdentity - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - 'encryption_identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.encryption_identity = kwargs.get('encryption_identity', None) - - -class EncryptionIdentity(msrest.serialization.Model): - """Encryption identity for the storage account. - - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str - """ - - _attribute_map = { - 'encryption_user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionIdentity, self).__init__(**kwargs) - self.encryption_user_assigned_identity = kwargs.get('encryption_user_assigned_identity', None) - - -class EncryptionScope(Resource): - """The Encryption Scope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): - Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", - "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, - Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeState - :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modification date and time of the encryption scope in - UTC. - :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a - required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: - ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, - 'require_infrastructure_encryption': {'key': 'properties.requireInfrastructureEncryption', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScope, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.state = kwargs.get('state', None) - self.creation_time = None - self.last_modified_time = None - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - - -class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): - """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_uri: The object identifier for a key vault key object. When applied, the encryption - scope will use the key referenced by the identifier to enable customer-managed key support on - this encryption scope. - :type key_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class EncryptionScopeListResult(msrest.serialization.Model): - """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of encryption scopes requested. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.EncryptionScope] - :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned - when total number of requested encryption scopes exceeds the maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type - implies that an account-scoped encryption key will be used. 'Service' key type implies that a - default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_02_01.models.KeyType - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - self.key_type = kwargs.get('key_type', None) - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = kwargs.get('table', None) - self.queue = kwargs.get('queue', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: - ~azure.mgmt.storage.v2021_02_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: - ~azure.mgmt.storage.v2021_02_01.models.StorageAccountInternetEndpoints - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, - 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - self.microsoft_endpoints = kwargs.get('microsoft_endpoints', None) - self.internet_endpoints = kwargs.get('internet_endpoints', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the storage resource provider. - - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_02_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body contract. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExtendedLocation(msrest.serialization.Model): - """The complex type of the extended location. - - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocationTypes - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: - ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_02_01.models.ProtocolSettings - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'protocol_settings': {'key': 'properties.protocolSettings', 'type': 'ProtocolSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.share_delete_retention_policy = kwargs.get('share_delete_retention_policy', None) - self.protocol_settings = kwargs.get('protocol_settings', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.snapshot_time = None - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.snapshot_time = None - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2021_02_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM - resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, - ~azure.mgmt.storage.v2021_02_01.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': 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': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2021_02_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyCreationTime(msrest.serialization.Model): - """Storage account keys creation time. - - :param key1: - :type key1: ~datetime.datetime - :param key2: - :type key2: ~datetime.datetime - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'iso-8601'}, - 'key2': {'key': 'key2', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyCreationTime, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) - - -class KeyPolicy(msrest.serialization.Model): - """KeyPolicy assigned to the storage account. - - All required parameters must be populated in order to send to Azure. - - :param key_expiration_period_in_days: Required. The key expiration period in days. - :type key_expiration_period_in_days: int - """ - - _validation = { - 'key_expiration_period_in_days': {'required': True}, - } - - _attribute_map = { - 'key_expiration_period_in_days': {'key': 'keyExpirationPeriodInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyPolicy, self).__init__(**kwargs) - self.key_expiration_period_in_days = kwargs['key_expiration_period_in_days'] - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class LastAccessTimeTrackingPolicy(msrest.serialization.Model): - """The blob service properties for Last access time based tracking policy. - - All required parameters must be populated in order to send to Azure. - - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently - read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_02_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in - days, typically how often the blob object should be tracked.This field is currently read only - with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported - value. This field is currently read only. - :type blob_type: list[str] - """ - - _validation = { - 'enable': {'required': True}, - } - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, - 'blob_type': {'key': 'blobType', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) - self.enable = kwargs['enable'] - self.name = kwargs.get('name', None) - self.tracking_granularity_in_days = kwargs.get('tracking_granularity_in_days', None) - self.blob_type = kwargs.get('blob_type', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_02_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListBlobInventoryPolicy(msrest.serialization.Model): - """List of blob inventory policies returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob inventory policies. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListBlobInventoryPolicy, self).__init__(**kwargs) - self.value = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_02_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueue(Resource): - """ListQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - - -class ListQueueResource(msrest.serialization.Model): - """Response schema. Contains list of queues returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queues returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.ListQueue] - :ivar next_link: Request URL that can be used to list next page of queues. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueueServices(msrest.serialization.Model): - """ListQueueServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queue services returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.QueueServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueServices, self).__init__(**kwargs) - self.value = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ListTableResource(msrest.serialization.Model): - """Response schema. Contains list of tables returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of tables returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.Table] - :ivar next_link: Request URL that can be used to query next page of tables. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Table]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListTableServices(msrest.serialization.Model): - """ListTableServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of table services returned. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.TableServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableServices, self).__init__(**kwargs) - self.value = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyVersion - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - self.version = kwargs.get('version', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - self.enable_auto_tier_to_hot_from_cool = kwargs.get('enable_auto_tier_to_hot_from_cool', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports - all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag - filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_02_01.models.TagFilter] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.blob_index_match = kwargs.get('blob_index_match', None) - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyVersion(msrest.serialization.Model): - """Management policy action for blob version. - - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob - version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyVersion, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_02_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class Multichannel(msrest.serialization.Model): - """Multichannel setting. Applies to Premium FileStorage only. - - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Multichannel, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_02_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_02_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_02_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_02_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_02_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'resource_access_rules': {'key': 'resourceAccessRules', 'type': '[ResourceAccessRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.resource_access_rules = kwargs.get('resource_access_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class ObjectReplicationPolicies(msrest.serialization.Model): - """List storage account object replication policies. - - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicies, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ObjectReplicationPolicy(Resource): - """The replication policy between two storage accounts. Multiple rules can be defined in one policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar policy_id: A unique id for object replication policy. - :vartype policy_id: str - :ivar enabled_time: Indicates when the policy is enabled on the source account. - :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyRule] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, - 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, - 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicy, self).__init__(**kwargs) - self.policy_id = None - self.enabled_time = None - self.source_account = kwargs.get('source_account', None) - self.destination_account = kwargs.get('destination_account', None) - self.rules = kwargs.get('rules', None) - - -class ObjectReplicationPolicyFilter(msrest.serialization.Model): - """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin - with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.min_creation_time = kwargs.get('min_creation_time', None) - - -class ObjectReplicationPolicyRule(msrest.serialization.Model): - """The replication policy rule between two containers. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is - required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyFilter - """ - - _validation = { - 'source_container': {'required': True}, - 'destination_container': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'source_container': {'key': 'sourceContainer', 'type': 'str'}, - 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyRule, self).__init__(**kwargs) - self.rule_id = kwargs.get('rule_id', None) - self.source_container = kwargs['source_container'] - self.destination_container = kwargs['destination_container'] - self.filters = kwargs.get('filters', None) - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_02_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_02_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :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(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storage.v2021_02_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type action_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class ProtocolSettings(msrest.serialization.Model): - """Protocol settings for file service. - - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_02_01.models.SmbSetting - """ - - _attribute_map = { - 'smb': {'key': 'smb', 'type': 'SmbSetting'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtocolSettings, self).__init__(**kwargs) - self.smb = kwargs.get('smb', None) - - -class QueueServiceProperties(Resource): - """The properties of a storage account’s Queue service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(QueueServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class ResourceAccessRule(msrest.serialization.Model): - """Resource Access Rule. - - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceAccessRule, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.resource_id = kwargs.get('resource_id', None) - - -class RestorePolicyProperties(msrest.serialization.Model): - """The blob service properties for blob restore policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than - DeleteRetentionPolicy.days. - :type days: int - :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. - :vartype last_enabled_time: ~datetime.datetime - :ivar min_restore_time: Returns the minimum date and time that the restore can be started. - :vartype min_restore_time: ~datetime.datetime - """ - - _validation = { - 'enabled': {'required': True}, - 'days': {'maximum': 365, 'minimum': 1}, - 'last_enabled_time': {'readonly': True}, - 'min_restore_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePolicyProperties, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs.get('days', None) - self.last_enabled_time = None - self.min_restore_time = None - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_02_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class RoutingPreference(msrest.serialization.Model): - """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. - Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_02_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing - storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing - storage endpoints are to be published. - :type publish_internet_endpoints: bool - """ - - _attribute_map = { - 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, - 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, - 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingPreference, self).__init__(**kwargs) - self.routing_choice = kwargs.get('routing_choice', None) - self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) - self.publish_internet_endpoints = kwargs.get('publish_internet_endpoints', None) - - -class SasPolicy(msrest.serialization.Model): - """SasPolicy assigned to the storage account. - - All required parameters must be populated in order to send to Azure. - - :param sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. - :type sas_expiration_period: str - :param expiration_action: Required. The SAS expiration action. Can only be Log. Possible values - include: "Log". Default value: "Log". - :type expiration_action: str or ~azure.mgmt.storage.v2021_02_01.models.ExpirationAction - """ - - _validation = { - 'sas_expiration_period': {'required': True}, - 'expiration_action': {'required': True}, - } - - _attribute_map = { - 'sas_expiration_period': {'key': 'sasExpirationPeriod', 'type': 'str'}, - 'expiration_action': {'key': 'expirationAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SasPolicy, self).__init__(**kwargs) - self.sas_expiration_period = kwargs['sas_expiration_period'] - self.expiration_action = kwargs.get('expiration_action', "Log") - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_02_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_02_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuInformation(msrest.serialization.Model): - """Storage SKU and its 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. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_02_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2021_02_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_02_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SmbSetting(msrest.serialization.Model): - """Setting for SMB protocol. - - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_02_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, - SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are - NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values - are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are - AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str - """ - - _attribute_map = { - 'multichannel': {'key': 'multichannel', 'type': 'Multichannel'}, - 'versions': {'key': 'versions', 'type': 'str'}, - 'authentication_methods': {'key': 'authenticationMethods', 'type': 'str'}, - 'kerberos_ticket_encryption': {'key': 'kerberosTicketEncryption', 'type': 'str'}, - 'channel_encryption': {'key': 'channelEncryption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SmbSetting, self).__init__(**kwargs) - self.multichannel = kwargs.get('multichannel', None) - self.versions = kwargs.get('versions', None) - self.authentication_methods = kwargs.get('authentication_methods', None) - self.kerberos_ticket_encryption = kwargs.get('kerberos_ticket_encryption', None) - self.channel_encryption = kwargs.get('channel_encryption', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_02_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_02_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2021_02_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2021_02_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2021_02_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain - :ivar sas_policy: SasPolicy assigned to the storage account. - :vartype sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy - :ivar key_policy: KeyPolicy assigned to the storage account. - :vartype key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy - :ivar key_creation_time: Storage account keys creation time. - :vartype key_creation_time: ~azure.mgmt.storage.v2021_02_01.models.KeyCreationTime - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2021_02_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_02_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage account. - :vartype private_endpoint_connections: - list[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference - :ivar blob_restore_status: Blob restore status. - :vartype blob_restore_status: ~azure.mgmt.storage.v2021_02_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'sas_policy': {'readonly': True}, - 'key_policy': {'readonly': True}, - 'key_creation_time': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'blob_restore_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'key_creation_time': {'key': 'properties.keyCreationTime', 'type': 'KeyCreationTime'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.extended_location = kwargs.get('extended_location', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.sas_policy = None - self.key_policy = None - self.key_creation_time = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.private_endpoint_connections = None - self.routing_preference = kwargs.get('routing_preference', None) - self.blob_restore_status = None - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the - storage account will be created in Azure main region. Otherwise it will be created in the - specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_02_01.models.Identity - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.extended_location = kwargs.get('extended_location', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.sas_policy = kwargs.get('sas_policy', None) - self.key_policy = kwargs.get('key_policy', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - - -class StorageAccountInternetEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountInternetEndpoints, self).__init__(**kwargs) - self.blob = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2021_02_01.models.KeyPermission - :ivar creation_time: Creation time of the key, in round trip date format. - :vartype creation_time: ~datetime.datetime - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - 'creation_time': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - self.creation_time = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2021_02_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_02_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.sas_policy = kwargs.get('sas_policy', None) - self.key_policy = kwargs.get('key_policy', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - - -class StorageQueue(Resource): - """StorageQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - :ivar approximate_message_count: Integer indicating an approximate number of messages in the - queue. This number is not lower than the actual number of messages in the queue, but could be - higher. - :vartype approximate_message_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'approximate_message_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - self.approximate_message_count = None - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.SkuInformation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_02_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_02_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Table(Resource): - """Properties of the table, including Id, resource name, resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar table_name: Table name under the specified account. - :vartype table_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'table_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Table, self).__init__(**kwargs) - self.table_name = None - - -class TableServiceProperties(Resource): - """The properties of a storage account’s Table service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(TableServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class TagFilter(msrest.serialization.Model): - """Blob index tag based filtering for blob objects. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and - filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can - have 0 - 256 characters. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 128, 'min_length': 1}, - 'op': {'required': True}, - 'value': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'op': {'key': 'op', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagFilter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.op = kwargs['op'] - self.value = kwargs['value'] - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2021_02_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2021_02_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the identity. - :vartype principal_id: str - :ivar client_id: The client ID of the identity. - :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(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", - "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_02_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py index 080542258ce2..898b0261417a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py @@ -20,31 +20,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_02_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2021_02_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -78,6 +78,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2021_02_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -94,19 +122,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -138,6 +166,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -178,6 +222,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -219,6 +265,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -228,12 +276,12 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2021_02_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2021_02_01.models.ActiveDirectoryProperties """ @@ -253,6 +301,15 @@ def __init__( active_directory_properties: Optional["ActiveDirectoryProperties"] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2021_02_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2021_02_01.models.ActiveDirectoryProperties + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -281,15 +338,15 @@ class BlobContainer(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -301,8 +358,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyProperties @@ -370,6 +427,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(BlobContainer, self).__init__(**kwargs) self.version = None self.deleted = None @@ -406,9 +476,8 @@ class BlobInventoryPolicy(Resource): :vartype system_data: ~azure.mgmt.storage.v2021_02_01.models.SystemData :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicySchema + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicySchema """ _validation = { @@ -434,6 +503,11 @@ def __init__( policy: Optional["BlobInventoryPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicySchema + """ super(BlobInventoryPolicy, self).__init__(**kwargs) self.system_data = None self.last_modified_time = None @@ -445,8 +519,8 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param filters: Required. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyFilter + :ivar filters: Required. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyFilter """ _validation = { @@ -463,6 +537,10 @@ def __init__( filters: "BlobInventoryPolicyFilter", **kwargs ): + """ + :keyword filters: Required. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyFilter + """ super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) self.filters = filters @@ -472,15 +550,15 @@ class BlobInventoryPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Valid values include - blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value set to true. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value set to true. - :type include_snapshots: bool + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value set to true. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :vartype include_snapshots: bool """ _validation = { @@ -503,6 +581,18 @@ def __init__( include_snapshots: Optional[bool] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Valid values include + blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value set to + true. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value set to true. + :paramtype include_snapshots: bool + """ super(BlobInventoryPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -515,13 +605,13 @@ class BlobInventoryPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyDefinition + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyDefinition """ _validation = { @@ -544,6 +634,15 @@ def __init__( definition: "BlobInventoryPolicyDefinition", **kwargs ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyDefinition + """ super(BlobInventoryPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -555,16 +654,16 @@ class BlobInventoryPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param destination: Required. Container name where blob inventory files are stored. Must be + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar destination: Required. Container name where blob inventory files are stored. Must be pre-created. - :type destination: str - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied + :vartype destination: str + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2021_02_01.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyRule] """ _validation = { @@ -590,6 +689,18 @@ def __init__( rules: List["BlobInventoryPolicyRule"], **kwargs ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2021_02_01.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyRule] + """ super(BlobInventoryPolicySchema, self).__init__(**kwargs) self.enabled = enabled self.destination = destination @@ -602,10 +713,10 @@ class BlobRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreRange] + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreRange] """ _validation = { @@ -625,6 +736,12 @@ def __init__( blob_ranges: List["BlobRestoreRange"], **kwargs ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreRange] + """ super(BlobRestoreParameters, self).__init__(**kwargs) self.time_to_restore = time_to_restore self.blob_ranges = blob_ranges @@ -635,10 +752,10 @@ class BlobRestoreRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str """ _validation = { @@ -658,6 +775,12 @@ def __init__( end_range: str, **kwargs ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ super(BlobRestoreRange, self).__init__(**kwargs) self.start_range = start_range self.end_range = end_range @@ -699,6 +822,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -727,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -746,31 +873,30 @@ class BlobServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_02_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_02_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2021_02_01.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2021_02_01.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: ~azure.mgmt.storage.v2021_02_01.models.LastAccessTimeTrackingPolicy """ @@ -811,6 +937,36 @@ def __init__( last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2021_02_01.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: ~azure.mgmt.storage.v2021_02_01.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2021_02_01.models.LastAccessTimeTrackingPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -827,12 +983,12 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - :type retention_in_days: int + :vartype retention_in_days: int """ _validation = { @@ -851,6 +1007,14 @@ def __init__( retention_in_days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled self.retention_in_days = retention_in_days @@ -889,6 +1053,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -898,17 +1064,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_02_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_02_01.models.CloudErrorBody] """ _attribute_map = { @@ -927,6 +1093,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_02_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -939,22 +1118,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2021_02_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -983,6 +1162,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2021_02_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -994,9 +1191,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2021_02_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2021_02_01.models.CorsRule] """ _attribute_map = { @@ -1009,6 +1206,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2021_02_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -1018,12 +1220,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -1042,6 +1244,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -1052,9 +1262,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -1071,6 +1281,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -1078,13 +1293,13 @@ def __init__( class DateAfterModification(msrest.serialization.Model): """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - :param days_after_modification_greater_than: Value indicating the age in days after last + :ivar days_after_modification_greater_than: Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy. - :type days_after_last_access_time_greater_than: float + :vartype days_after_last_access_time_greater_than: float """ _validation = { @@ -1104,6 +1319,15 @@ def __init__( days_after_last_access_time_greater_than: Optional[float] = None, **kwargs ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than @@ -1140,6 +1364,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1195,6 +1421,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1229,6 +1457,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1239,12 +1469,12 @@ class DeletedShare(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str """ _validation = { @@ -1264,6 +1494,14 @@ def __init__( deleted_share_version: str, **kwargs ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ super(DeletedShare, self).__init__(**kwargs) self.deleted_share_name = deleted_share_name self.deleted_share_version = deleted_share_version @@ -1272,11 +1510,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -1295,6 +1533,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1303,10 +1548,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1321,6 +1566,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1331,19 +1582,19 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_02_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2021_02_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_02_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :vartype key_source: str or ~azure.mgmt.storage.v2021_02_01.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_02_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_02_01.models.EncryptionIdentity + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_02_01.models.KeyVaultProperties + :ivar encryption_identity: The identity to be used with service-side encryption at rest. + :vartype encryption_identity: ~azure.mgmt.storage.v2021_02_01.models.EncryptionIdentity """ _validation = { @@ -1368,6 +1619,21 @@ def __init__( encryption_identity: Optional["EncryptionIdentity"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2021_02_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2021_02_01.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2021_02_01.models.KeyVaultProperties + :keyword encryption_identity: The identity to be used with service-side encryption at rest. + :paramtype encryption_identity: ~azure.mgmt.storage.v2021_02_01.models.EncryptionIdentity + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -1379,9 +1645,9 @@ def __init__( class EncryptionIdentity(msrest.serialization.Model): """Encryption identity for the storage account. - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str + :ivar encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to be + associated with server-side encryption on the storage account. + :vartype encryption_user_assigned_identity: str """ _attribute_map = { @@ -1394,6 +1660,11 @@ def __init__( encryption_user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to + be associated with server-side encryption on the storage account. + :paramtype encryption_user_assigned_identity: str + """ super(EncryptionIdentity, self).__init__(**kwargs) self.encryption_user_assigned_identity = encryption_user_assigned_identity @@ -1411,25 +1682,25 @@ class EncryptionScope(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + :vartype source: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeState + :vartype state: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeState :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. :vartype creation_time: ~datetime.datetime :ivar last_modified_time: Gets the last modification date and time of the encryption scope in UTC. :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool + :vartype require_infrastructure_encryption: bool """ _validation = { @@ -1461,6 +1732,22 @@ def __init__( require_infrastructure_encryption: Optional[bool] = None, **kwargs ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeKeyVaultProperties + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + """ super(EncryptionScope, self).__init__(**kwargs) self.source = source self.state = state @@ -1475,10 +1762,10 @@ class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_uri: The object identifier for a key vault key object. When applied, the encryption + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - :type key_uri: str + :vartype key_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -1503,6 +1790,12 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri self.current_versioned_key_identifier = None @@ -1535,6 +1828,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1545,17 +1840,17 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_02_01.models.KeyType + :vartype key_type: str or ~azure.mgmt.storage.v2021_02_01.models.KeyType """ _validation = { @@ -1575,6 +1870,15 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2021_02_01.models.KeyType + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -1584,14 +1888,14 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService """ _attribute_map = { @@ -1610,6 +1914,16 @@ def __init__( queue: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2021_02_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -1634,11 +1948,11 @@ class Endpoints(msrest.serialization.Model): :vartype web: str :ivar dfs: Gets the dfs endpoint. :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountInternetEndpoints """ @@ -1669,6 +1983,14 @@ def __init__( internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, **kwargs ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2021_02_01.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2021_02_01.models.StorageAccountInternetEndpoints + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -1683,8 +2005,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the storage resource provider. - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_02_01.models.ErrorResponseBody + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2021_02_01.models.ErrorResponseBody """ _attribute_map = { @@ -1697,6 +2019,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2021_02_01.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1704,12 +2030,12 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body contract. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1724,6 +2050,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1732,10 +2066,10 @@ def __init__( class ExtendedLocation(msrest.serialization.Model): """The complex type of the extended location. - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -1750,6 +2084,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -1776,6 +2116,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1795,15 +2137,15 @@ class FileServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: + :vartype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_02_01.models.ProtocolSettings + :ivar protocol_settings: Protocol settings for file service. + :vartype protocol_settings: ~azure.mgmt.storage.v2021_02_01.models.ProtocolSettings """ _validation = { @@ -1831,6 +2173,17 @@ def __init__( protocol_settings: Optional["ProtocolSettings"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2021_02_01.models.DeleteRetentionPolicy + :keyword protocol_settings: Protocol settings for file service. + :paramtype protocol_settings: ~azure.mgmt.storage.v2021_02_01.models.ProtocolSettings + """ super(FileServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -1855,17 +2208,17 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1874,10 +2227,10 @@ class FileShare(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -1938,6 +2291,23 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -1972,17 +2342,17 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -1991,10 +2361,10 @@ class FileShareItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2055,6 +2425,23 @@ def __init__( access_tier: Optional[Union[str, "ShareAccessTier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_02_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_02_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.ShareAccessTier + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2098,6 +2485,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2141,6 +2530,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2158,13 +2549,13 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", + :ivar type: Required. The identity type. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM + :vartype type: str or ~azure.mgmt.storage.v2021_02_01.models.IdentityType + :ivar user_assigned_identities: Gets or sets a list of key value pairs that describe the set of + User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.storage.v2021_02_01.models.UserAssignedIdentity] """ @@ -2188,6 +2579,16 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: Required. The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.storage.v2021_02_01.models.IdentityType + :keyword user_assigned_identities: Gets or sets a list of key value pairs that describe the set + of User Assigned identities that will be used with this storage account. The key is the ARM + resource identifier of the identity. Only 1 User Assigned identity is permitted here. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.storage.v2021_02_01.models.UserAssignedIdentity] + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2210,18 +2611,18 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2249,6 +2650,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -2264,18 +2676,18 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2021_02_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2299,6 +2711,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -2312,12 +2735,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -2336,6 +2759,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -2344,10 +2775,10 @@ def __init__( class KeyCreationTime(msrest.serialization.Model): """Storage account keys creation time. - :param key1: - :type key1: ~datetime.datetime - :param key2: - :type key2: ~datetime.datetime + :ivar key1: + :vartype key1: ~datetime.datetime + :ivar key2: + :vartype key2: ~datetime.datetime """ _attribute_map = { @@ -2362,6 +2793,12 @@ def __init__( key2: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ super(KeyCreationTime, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 @@ -2372,8 +2809,8 @@ class KeyPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_expiration_period_in_days: Required. The key expiration period in days. - :type key_expiration_period_in_days: int + :ivar key_expiration_period_in_days: Required. The key expiration period in days. + :vartype key_expiration_period_in_days: int """ _validation = { @@ -2390,6 +2827,10 @@ def __init__( key_expiration_period_in_days: int, **kwargs ): + """ + :keyword key_expiration_period_in_days: Required. The key expiration period in days. + :paramtype key_expiration_period_in_days: int + """ super(KeyPolicy, self).__init__(**kwargs) self.key_expiration_period_in_days = key_expiration_period_in_days @@ -2399,12 +2840,12 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -2433,6 +2874,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2446,18 +2895,18 @@ class LastAccessTimeTrackingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_02_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in + :vartype name: str or ~azure.mgmt.storage.v2021_02_01.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only. - :type blob_type: list[str] + :vartype blob_type: list[str] """ _validation = { @@ -2480,6 +2929,20 @@ def __init__( blob_type: Optional[List[str]] = None, **kwargs ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2021_02_01.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) self.enable = enable self.name = name @@ -2492,20 +2955,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2530,6 +2993,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2541,11 +3020,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2560,6 +3039,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2577,9 +3063,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -2598,6 +3084,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2613,8 +3104,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_02_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2021_02_01.models.TagProperty] """ _validation = { @@ -2632,6 +3123,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2021_02_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2658,6 +3153,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2683,6 +3180,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2710,15 +3209,15 @@ class ListContainerItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -2730,8 +3229,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicyProperties @@ -2799,6 +3298,19 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_02_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + """ super(ListContainerItem, self).__init__(**kwargs) self.version = None self.deleted = None @@ -2844,6 +3356,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2862,8 +3376,8 @@ class ListQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] """ _validation = { @@ -2885,6 +3399,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = metadata @@ -2914,6 +3432,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2940,6 +3460,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2965,6 +3487,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2994,6 +3518,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3020,6 +3546,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -3039,9 +3567,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySchema """ _validation = { @@ -3065,6 +3593,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -3073,12 +3606,12 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyVersion + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyVersion """ _attribute_map = { @@ -3095,6 +3628,14 @@ def __init__( version: Optional["ManagementPolicyVersion"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyVersion + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -3104,18 +3645,17 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool """ _attribute_map = { @@ -3134,6 +3674,20 @@ def __init__( enable_auto_tier_to_hot_from_cool: Optional[bool] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3146,10 +3700,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyFilter """ _validation = { @@ -3168,6 +3722,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -3178,14 +3738,14 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_02_01.models.TagFilter] + :vartype blob_index_match: list[~azure.mgmt.storage.v2021_02_01.models.TagFilter] """ _validation = { @@ -3206,6 +3766,16 @@ def __init__( blob_index_match: Optional[List["TagFilter"]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2021_02_01.models.TagFilter] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -3217,15 +3787,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_02_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2021_02_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyDefinition """ _validation = { @@ -3250,6 +3820,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2021_02_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -3262,9 +3843,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyRule] """ _validation = { @@ -3281,6 +3862,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -3288,14 +3874,14 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation """ _attribute_map = { @@ -3312,6 +3898,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3321,14 +3917,14 @@ def __init__( class ManagementPolicyVersion(msrest.serialization.Model): """Management policy action for blob version. - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation """ _attribute_map = { @@ -3345,6 +3941,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2021_02_01.models.DateAfterCreation + """ super(ManagementPolicyVersion, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3354,24 +3960,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_02_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2021_02_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -3400,6 +4006,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2021_02_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3415,8 +4041,8 @@ def __init__( class Multichannel(msrest.serialization.Model): """Multichannel setting. Applies to Premium FileStorage only. - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -3429,6 +4055,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = enabled @@ -3438,20 +4068,20 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_02_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_02_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_02_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_02_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2021_02_01.models.Bypass + :ivar resource_access_rules: Sets the resource access rules. + :vartype resource_access_rules: list[~azure.mgmt.storage.v2021_02_01.models.ResourceAccessRule] + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2021_02_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2021_02_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_02_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2021_02_01.models.DefaultAction """ _validation = { @@ -3476,6 +4106,24 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2021_02_01.models.Bypass + :keyword resource_access_rules: Sets the resource access rules. + :paramtype resource_access_rules: + list[~azure.mgmt.storage.v2021_02_01.models.ResourceAccessRule] + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2021_02_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2021_02_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2021_02_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.resource_access_rules = resource_access_rules @@ -3487,8 +4135,8 @@ def __init__( class ObjectReplicationPolicies(msrest.serialization.Model): """List storage account object replication policies. - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy] + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy] """ _attribute_map = { @@ -3501,6 +4149,10 @@ def __init__( value: Optional[List["ObjectReplicationPolicy"]] = None, **kwargs ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy] + """ super(ObjectReplicationPolicies, self).__init__(**kwargs) self.value = value @@ -3522,12 +4174,12 @@ class ObjectReplicationPolicy(Resource): :vartype policy_id: str :ivar enabled_time: Indicates when the policy is enabled on the source account. :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. - :type source_account: str - :param destination_account: Required. Destination account name. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyRule] + :ivar source_account: Required. Source account name. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyRule] """ _validation = { @@ -3557,6 +4209,14 @@ def __init__( rules: Optional[List["ObjectReplicationPolicyRule"]] = None, **kwargs ): + """ + :keyword source_account: Required. Source account name. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: list[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyRule] + """ super(ObjectReplicationPolicy, self).__init__(**kwargs) self.policy_id = None self.enabled_time = None @@ -3568,12 +4228,12 @@ def __init__( class ObjectReplicationPolicyFilter(msrest.serialization.Model): """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str """ _attribute_map = { @@ -3588,6 +4248,14 @@ def __init__( min_creation_time: Optional[str] = None, **kwargs ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.min_creation_time = min_creation_time @@ -3598,15 +4266,15 @@ class ObjectReplicationPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyFilter + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyFilter """ _validation = { @@ -3630,6 +4298,17 @@ def __init__( filters: Optional["ObjectReplicationPolicyFilter"] = None, **kwargs ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicyFilter + """ super(ObjectReplicationPolicyRule, self).__init__(**kwargs) self.rule_id = rule_id self.source_container = source_container @@ -3640,14 +4319,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_02_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_02_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2021_02_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2021_02_01.models.ServiceSpecification """ _attribute_map = { @@ -3666,6 +4345,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2021_02_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2021_02_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3676,14 +4365,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -3702,6 +4391,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3712,8 +4411,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.Operation] """ _attribute_map = { @@ -3726,6 +4425,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2021_02_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -3751,6 +4454,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3768,11 +4473,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storage.v2021_02_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -3803,6 +4508,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2021_02_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -3812,8 +4525,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection] """ _attribute_map = { @@ -3826,6 +4539,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -3847,8 +4564,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -3874,6 +4591,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -3883,8 +4604,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateLinkResource] """ _attribute_map = { @@ -3897,6 +4618,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2021_02_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -3904,15 +4629,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -3929,6 +4654,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -3938,8 +4674,8 @@ def __init__( class ProtocolSettings(msrest.serialization.Model): """Protocol settings for file service. - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_02_01.models.SmbSetting + :ivar smb: Setting for SMB protocol. + :vartype smb: ~azure.mgmt.storage.v2021_02_01.models.SmbSetting """ _attribute_map = { @@ -3952,6 +4688,10 @@ def __init__( smb: Optional["SmbSetting"] = None, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_02_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = smb @@ -3969,10 +4709,10 @@ class QueueServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules """ _validation = { @@ -3994,6 +4734,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + """ super(QueueServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -4001,10 +4747,10 @@ def __init__( class ResourceAccessRule(msrest.serialization.Model): """Resource Access Rule. - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar resource_id: Resource Id. + :vartype resource_id: str """ _attribute_map = { @@ -4019,6 +4765,12 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ super(ResourceAccessRule, self).__init__(**kwargs) self.tenant_id = tenant_id self.resource_id = resource_id @@ -4031,11 +4783,11 @@ class RestorePolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than + :ivar enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - :type days: int + :vartype days: int :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. :vartype last_enabled_time: ~datetime.datetime :ivar min_restore_time: Returns the minimum date and time that the restore can be started. @@ -4063,6 +4815,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -4080,11 +4839,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_02_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2021_02_01.models.ReasonCode """ _validation = { @@ -4104,6 +4863,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2021_02_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -4113,15 +4879,15 @@ def __init__( class RoutingPreference(msrest.serialization.Model): """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_02_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + :vartype routing_choice: str or ~azure.mgmt.storage.v2021_02_01.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing storage endpoints are to be published. - :type publish_internet_endpoints: bool + :vartype publish_internet_endpoints: bool """ _attribute_map = { @@ -4138,6 +4904,17 @@ def __init__( publish_internet_endpoints: Optional[bool] = None, **kwargs ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2021_02_01.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ super(RoutingPreference, self).__init__(**kwargs) self.routing_choice = routing_choice self.publish_microsoft_endpoints = publish_microsoft_endpoints @@ -4149,11 +4926,11 @@ class SasPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. - :type sas_expiration_period: str - :param expiration_action: Required. The SAS expiration action. Can only be Log. Possible values + :ivar sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :vartype sas_expiration_period: str + :ivar expiration_action: Required. The SAS expiration action. Can only be Log. Possible values include: "Log". Default value: "Log". - :type expiration_action: str or ~azure.mgmt.storage.v2021_02_01.models.ExpirationAction + :vartype expiration_action: str or ~azure.mgmt.storage.v2021_02_01.models.ExpirationAction """ _validation = { @@ -4173,6 +4950,13 @@ def __init__( expiration_action: Union[str, "ExpirationAction"] = "Log", **kwargs ): + """ + :keyword sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :paramtype sas_expiration_period: str + :keyword expiration_action: Required. The SAS expiration action. Can only be Log. Possible + values include: "Log". Default value: "Log". + :paramtype expiration_action: str or ~azure.mgmt.storage.v2021_02_01.models.ExpirationAction + """ super(SasPolicy, self).__init__(**kwargs) self.sas_expiration_period = sas_expiration_period self.expiration_action = expiration_action @@ -4183,49 +4967,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -4277,6 +5060,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2021_02_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_02_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_02_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -4301,8 +5130,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_02_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2021_02_01.models.MetricSpecification] """ _attribute_map = { @@ -4315,6 +5145,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2021_02_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4326,11 +5161,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_02_01.models.SkuTier @@ -4352,6 +5187,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4383,6 +5225,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4395,11 +5239,11 @@ class SkuInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_02_01.models.SkuTier @@ -4414,9 +5258,9 @@ class SkuInformation(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2021_02_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_02_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2021_02_01.models.Restriction] """ _validation = { @@ -4445,6 +5289,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_02_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2021_02_01.models.Restriction] + """ super(SkuInformation, self).__init__(**kwargs) self.name = name self.tier = None @@ -4458,20 +5312,20 @@ def __init__( class SmbSetting(msrest.serialization.Model): """Setting for SMB protocol. - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_02_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + :ivar multichannel: Multichannel setting. Applies to Premium FileStorage only. + :vartype multichannel: ~azure.mgmt.storage.v2021_02_01.models.Multichannel + :ivar versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are + :vartype versions: str + :ivar authentication_methods: SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values + :vartype authentication_methods: str + :ivar kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are + :vartype kerberos_ticket_encryption: str + :ivar channel_encryption: SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str + :vartype channel_encryption: str """ _attribute_map = { @@ -4492,6 +5346,22 @@ def __init__( channel_encryption: Optional[str] = None, **kwargs ): + """ + :keyword multichannel: Multichannel setting. Applies to Premium FileStorage only. + :paramtype multichannel: ~azure.mgmt.storage.v2021_02_01.models.Multichannel + :keyword versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + SMB3.1.1. Should be passed as a string with delimiter ';'. + :paramtype versions: str + :keyword authentication_methods: SMB authentication methods supported by server. Valid values + are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + :paramtype authentication_methods: str + :keyword kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid + values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. + :paramtype kerberos_ticket_encryption: str + :keyword channel_encryption: SMB channel encryption supported by server. Valid values are + AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + :paramtype channel_encryption: str + """ super(SmbSetting, self).__init__(**kwargs) self.multichannel = multichannel self.versions = versions @@ -4515,10 +5385,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -4543,6 +5413,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -4563,19 +5439,19 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_02_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_02_01.models.Identity + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_02_01.models.ProvisioningState @@ -4620,48 +5496,48 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_02_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState :ivar private_endpoint_connections: List of private endpoint connection associated with the specified storage account. :vartype private_endpoint_connections: list[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference + :vartype routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference :ivar blob_restore_status: Blob restore status. :vartype blob_restore_status: ~azure.mgmt.storage.v2021_02_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool """ _validation = { @@ -4752,6 +5628,46 @@ def __init__( enable_nfs_v3: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_02_01.models.Identity + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -4795,8 +5711,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -4820,6 +5736,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -4829,73 +5749,73 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the + :vartype location: str + :ivar extended_location: Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_02_01.models.Identity - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_02_01.models.Identity + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool """ _validation = { @@ -4954,6 +5874,75 @@ def __init__( enable_nfs_v3: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword extended_location: Optional. Set the extended location of the resource. If not set, + the storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :paramtype extended_location: ~azure.mgmt.storage.v2021_02_01.models.ExtendedLocation + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_02_01.models.Identity + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -5011,6 +6000,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -5052,6 +6043,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -5081,6 +6074,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -5111,6 +6106,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5157,6 +6154,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -5171,9 +6170,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -5190,6 +6189,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -5197,62 +6201,61 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_02_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_02_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_02_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool + :vartype allow_shared_key_access: bool """ _attribute_map = { @@ -5297,6 +6300,65 @@ def __init__( allow_shared_key_access: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2021_02_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_02_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_02_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_02_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2021_02_01.models.Encryption + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_02_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_02_01.models.KeyPolicy + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_02_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_02_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_02_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_02_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_02_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_02_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -5330,8 +6392,8 @@ class StorageQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] :ivar approximate_message_count: Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. @@ -5359,6 +6421,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = metadata self.approximate_message_count = None @@ -5385,6 +6451,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5392,20 +6460,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_02_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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.storage.v2021_02_01.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". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_02_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.storage.v2021_02_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -5428,6 +6496,22 @@ def __init__( 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.storage.v2021_02_01.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.storage.v2021_02_01.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 @@ -5472,6 +6556,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5489,10 +6575,10 @@ class TableServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules """ _validation = { @@ -5514,6 +6600,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2021_02_01.models.CorsRules + """ super(TableServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -5523,14 +6615,14 @@ class TagFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters. - :type value: str + :vartype value: str """ _validation = { @@ -5553,6 +6645,16 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ super(TagFilter, self).__init__(**kwargs) self.name = name self.op = op @@ -5596,6 +6698,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5648,6 +6752,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5691,6 +6797,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5701,8 +6809,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_02_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2021_02_01.models.Usage] """ _attribute_map = { @@ -5715,6 +6823,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2021_02_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -5744,6 +6856,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5774,6 +6888,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5784,15 +6900,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_02_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2021_02_01.models.State """ _validation = { @@ -5813,6 +6929,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "provisioning", "deprovisioning", "succeeded", "failed", "networkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2021_02_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py index f4fe9fdaa260..2c4c8c6bcf53 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,11 +26,11 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class BlobInventoryPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. @@ -55,7 +40,7 @@ class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En COMPLETE = "Complete" FAILED = "Failed" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -66,7 +51,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -76,7 +61,7 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -85,14 +70,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -100,7 +85,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication protocol that is used for the file share. Can only be specified when creating a share. """ @@ -108,7 +93,7 @@ class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SMB = "SMB" NFS = "NFS" -class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. """ @@ -116,26 +101,26 @@ class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class EncryptionScopeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class ExpirationAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpirationAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SAS expiration action. Can only be Log. """ LOG = "Log" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -147,14 +132,14 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -163,14 +148,14 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -179,20 +164,20 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class InventoryRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Inventory """ INVENTORY = "Inventory" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -200,7 +185,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. @@ -209,7 +194,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE = "Service" ACCOUNT = "Account" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -219,14 +204,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -236,7 +221,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -244,7 +229,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -254,27 +239,27 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ListContainersInclude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" -class ListSharesExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListSharesExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" SNAPSHOTS = "snapshots" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -283,13 +268,13 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only """ ACCESS_TIME_TRACKING = "AccessTimeTracking" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -303,7 +288,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -312,7 +297,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -320,7 +305,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -328,7 +313,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -336,11 +321,11 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class PutSharesExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PutSharesExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SNAPSHOTS = "snapshots" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -348,7 +333,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -358,7 +343,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The property is for NFS share only. The default is NoRootSquash. """ @@ -366,20 +351,20 @@ class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class RoutingChoice(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Routing Choice defines the kind of network routing opted by the user. """ MICROSOFT_ROUTING = "MicrosoftRouting" INTERNET_ROUTING = "InternetRouting" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -389,7 +374,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. """ @@ -399,7 +384,7 @@ class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" PREMIUM = "Premium" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -409,7 +394,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -419,7 +404,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -433,14 +418,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -450,12 +435,12 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "failed" NETWORK_SOURCE_DELETED = "networkSourceDeleted" -class StorageAccountExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO_REPLICATION_STATS = "geoReplicationStats" BLOB_RESTORE_STATUS = "blobRestoreStatus" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py index fcaeb6eddd6c..36a7bdbf7015 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py @@ -5,23 +5,593 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,16 +615,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - include=None, # type: Optional[Union[str, "_models.ListContainersInclude"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -83,42 +653,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,20 +703,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -178,33 +746,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,17 +780,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -260,33 +820,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,16 +850,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -334,28 +886,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,16 +911,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -403,26 +947,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,15 +971,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -472,33 +1009,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,17 +1039,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -550,33 +1079,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -590,18 +1109,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -634,40 +1155,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,23 +1185,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -723,32 +1234,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,23 +1256,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the @@ -806,31 +1307,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -840,23 +1329,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -886,29 +1378,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -918,24 +1400,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -969,37 +1454,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1009,23 +1484,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1053,36 +1531,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,4 +1564,6 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py index 15dbb8bc5271..c76a677f9dd4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +222,8 @@ def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy @@ -75,34 +234,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -111,17 +260,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - properties, # type: "_models.BlobInventoryPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Sets the blob inventory policy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -133,7 +284,8 @@ def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -146,39 +298,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -187,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: """Deletes the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -208,7 +352,8 @@ def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicyName :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 @@ -219,34 +364,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -254,13 +389,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListBlobInventoryPolicy"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -271,8 +407,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -280,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -322,12 +457,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py index 5e4ffe367da9..7258c47141f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-02-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -71,36 +192,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +236,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +273,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +302,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +333,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +357,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py index 93fb0dcdbc5f..024fc693070e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py @@ -5,23 +5,91 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + deleted_account_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}') + path_format_arguments = { + "deletedAccountName": _SERIALIZER.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,16 +113,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedAccountListResult"]: """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -62,34 +132,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,24 +167,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace def get( self, - deleted_account_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedAccount" + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": """Get properties of specified deleted account resource. :param deleted_account_name: Name of the deleted storage account. @@ -136,33 +202,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -171,4 +227,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py index 33d54b529b56..80fc9f9a9203 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py @@ -5,23 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,15 +212,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. @@ -82,39 +249,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -127,17 +284,19 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. @@ -165,39 +324,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -206,16 +355,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": """Returns the properties for the specified encryption scope. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -240,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -276,15 +417,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionScopeListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: """Lists all the encryption scopes available under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -295,8 +438,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -304,36 +449,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,6 +493,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py index 47c4c852058e..50884aa0129c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-02-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py index f2ac752dbf74..e17c0cebafed 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py @@ -5,23 +5,297 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, "_models.ListSharesExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + expand: Optional[Union[str, "_models.PutSharesExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + 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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = "stats", + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +319,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - expand=None, # type: Optional[Union[str, "_models.ListSharesExpand"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, "_models.ListSharesExpand"]] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -82,42 +356,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,21 +406,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - expand=None, # type: Optional[Union[str, "_models.PutSharesExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[Union[str, "_models.PutSharesExpand"]] = None, + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -180,35 +452,24 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,17 +487,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -264,33 +527,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,18 +557,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - expand="stats", # type: Optional[str] - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = "stats", + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -330,7 +585,8 @@ def get( dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param expand: Optional, used to expand the properties within share's properties. + :param expand: Optional, used to expand the properties within share's properties. The default + value is "stats". :type expand: str :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. :type x_ms_snapshot: str @@ -344,32 +600,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -383,17 +627,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -420,30 +666,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -456,15 +691,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def restore( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - deleted_share, # type: "_models.DeletedShare" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: """Restore a file share within a valid retention days if share soft delete is enabled. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -491,33 +727,23 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -529,3 +755,4 @@ def restore( return cls(pipeline_response, None, {}) restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py index 4679cdf31df1..26c3ae219f70 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py index c100b853f939..716cf2ec567d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ObjectReplicationPolicies"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: """List the object replication policies associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Get the object replication policy of the storage account by policy ID. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -154,34 +312,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -190,17 +338,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - properties, # type: "_models.ObjectReplicationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Create or update the object replication policy of the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -226,39 +376,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -267,16 +407,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: """Deletes the object replication policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -299,37 +441,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py index 8e6ad26eeb24..0c5caf21402b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2021_02_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py index 43b1ea1c157d..08ad3424c854 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,17 +337,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -224,39 +374,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -265,16 +405,18 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -297,37 +439,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py index 0e505bf5c0bf..24c367dcc20a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +107,17 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +131,6 @@ def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py index d5e7fdcac676..2cd75c653626 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): """QueueOperations operations. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -80,33 +291,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +321,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -157,33 +360,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,16 +390,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": """Gets the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -231,28 +426,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -266,16 +451,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -300,28 +487,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -334,15 +511,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListQueueResource"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: """Gets a list of all the queues under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -368,40 +546,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,6 +594,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py index b91df8883103..a1b09c9461d6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-02-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListQueueServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": """List all queue services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.QueueServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py index 5baf31bb9ec2..d53fc785928c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py index 47c07ebfcb52..e7ea8b44b2d3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py @@ -5,25 +5,561 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +583,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_02_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.CheckNameAvailabilityResult @@ -69,30 +606,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +633,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +680,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +708,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_02_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +732,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +758,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +787,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +810,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -332,29 +844,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +869,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -406,32 +909,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,19 +938,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -465,34 +962,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +1002,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -528,8 +1021,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_02_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -537,35 +1032,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -583,19 +1074,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -606,7 +1098,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -618,29 +1111,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,16 +1136,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -675,7 +1159,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_02_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountListKeysResult @@ -686,32 +1171,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,16 +1200,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -756,32 +1233,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,16 +1262,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -826,32 +1295,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,39 +1324,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2021-02-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,13 +1362,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -930,15 +1383,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -952,21 +1407,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -978,47 +1426,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore def _restore_blob_ranges_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobRestoreStatus" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,16 +1474,18 @@ def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace def begin_restore_blob_ranges( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BlobRestoreStatus"] + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: """Restore blobs in the specified blob ranges. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1059,15 +1499,19 @@ def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_02_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) + :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 BlobRestoreStatus or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_02_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1079,27 +1523,21 @@ def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1111,15 +1549,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1139,25 +1578,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1169,3 +1600,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py index 370bf18b70d1..9b6d2b8c9cf2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): """TableOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -76,28 +261,18 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,16 +286,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -144,28 +321,18 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,16 +346,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Gets the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -212,28 +381,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,16 +406,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -280,28 +441,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -314,13 +465,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListTableResource"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: """Gets a list of all the tables under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -340,36 +492,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -387,6 +536,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py index 7421eed424c3..cb265d449b3e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-02-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): """TableServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListTableServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": """List all table services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +191,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,16 +215,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.TableServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": """Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -137,34 +250,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,15 +279,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": """Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -207,29 +310,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,4 +334,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py index 0a8d406c4a18..99a3c9fc116c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py index 353e929caf0c..84908f76532b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json index cf0bcf35807c..b21b95219e92 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py index 8f9ee1bfcb0e..8cacd6b7c870 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py @@ -6,42 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -55,17 +35,23 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_04_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_04_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_04_01.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_04_01.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_04_01.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_04_01.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_04_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_04_01.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_04_01.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_04_01.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_04_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_04_01.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_04_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_04_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -86,84 +72,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py index f23229b6d6ec..9ba3f2dc71c9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py index d99778b3abef..19c81e0f0a0b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py @@ -6,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -47,27 +29,36 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2021_04_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2021_04_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2021_04_01.aio.operations.StorageAccountsOperations :ivar deleted_accounts: DeletedAccountsOperations operations - :vartype deleted_accounts: azure.mgmt.storage.v2021_04_01.aio.operations.DeletedAccountsOperations + :vartype deleted_accounts: + azure.mgmt.storage.v2021_04_01.aio.operations.DeletedAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_04_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_04_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_04_01.aio.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_04_01.aio.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_04_01.aio.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_04_01.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_04_01.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_04_01.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_04_01.aio.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_04_01.aio.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_04_01.aio.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_04_01.aio.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_04_01.aio.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_04_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2021_04_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2021_04_01.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations :vartype file_services: azure.mgmt.storage.v2021_04_01.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations @@ -84,82 +75,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py index a33a46f660c8..a093d01675bd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_object_level_worm_request_initial, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -72,7 +78,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2021_04_01.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -80,42 +87,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +137,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -174,33 +180,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -218,8 +214,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -255,33 +254,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -295,8 +284,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -328,28 +320,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -363,8 +345,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -396,26 +381,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,6 +405,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -464,33 +443,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -504,8 +473,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -541,33 +513,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -581,8 +543,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -624,40 +589,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -667,14 +619,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -712,32 +668,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -747,14 +690,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -794,31 +741,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -828,14 +763,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -873,29 +812,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -905,14 +834,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -955,37 +888,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -995,14 +918,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1038,36 +965,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1081,8 +998,10 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + async def _object_level_worm_initial( self, resource_group_name: str, @@ -1095,28 +1014,18 @@ async def _object_level_worm_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._object_level_worm_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_object_level_worm_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self._object_level_worm_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1129,6 +1038,8 @@ async def _object_level_worm_initial( _object_level_worm_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore + + @distributed_trace_async async def begin_object_level_worm( self, resource_group_name: str, @@ -1155,15 +1066,17 @@ async def begin_object_level_worm( :type container_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -1178,22 +1091,14 @@ async def begin_object_level_worm( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1205,4 +1110,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_object_level_worm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py index 5db228f296d8..1ce152b88419 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -106,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -127,7 +127,8 @@ async def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,39 +141,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -181,8 +172,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,7 +195,8 @@ async def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName :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 @@ -212,34 +207,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -247,6 +232,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -263,8 +250,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -272,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -314,12 +300,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py index afdd15842a39..0ab3345263d0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py index 6ef845000d4b..b9cfeddc1147 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._deleted_accounts_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,17 +100,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace_async async def get( self, deleted_account_name: str, @@ -130,33 +135,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -165,4 +160,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py index c3e1d35abff2..e9981b389526 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def put( self, resource_group_name: str, @@ -77,39 +83,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -122,8 +118,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -159,39 +158,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -200,8 +189,11 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,34 +225,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -269,8 +251,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -287,8 +272,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -296,36 +283,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -343,6 +327,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py index 42a5083fc2e5..1d8989a361cc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceItems', pipeline_response) @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -132,40 +130,28 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -174,8 +160,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -202,35 +191,23 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -239,4 +216,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py index e61cb48fafb6..f84326c85c44 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_lease_request, build_list_request, build_restore_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,17 +130,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -177,41 +183,30 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -224,8 +219,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -261,39 +259,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -302,8 +290,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -342,38 +333,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -382,8 +361,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -426,38 +408,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + include=include, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -465,6 +435,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def restore( self, resource_group_name: str, @@ -499,39 +471,29 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -539,6 +501,8 @@ async def restore( restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -577,52 +541,44 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseShareRequest') + _json = self._serialize.body(parameters, 'LeaseShareRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + x_ms_snapshot=x_ms_snapshot, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LeaseShareResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py index d351d125a0f6..36179b99e6c3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py index 0d318fb806b7..1a40b9bcd7a6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -150,34 +157,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -186,8 +183,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -223,39 +223,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -264,8 +254,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -297,37 +290,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py index ec690abe837d..fb7fdb3e0719 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py index f9802d859688..52eb4c9342f1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -217,39 +217,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -258,8 +248,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -289,37 +282,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py index a340af4dd0c8..3100d697ce88 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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_list_by_storage_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_account( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,4 +94,6 @@ async def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py index d6b2efbd39d6..f5d13f2a3bbe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -75,39 +81,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -116,8 +112,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -152,39 +151,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -193,8 +182,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -226,34 +218,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -262,8 +244,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -295,34 +280,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -330,6 +305,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -355,7 +332,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListQueueResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -363,40 +341,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -409,12 +384,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py index 015027550a17..b9d96b4025ef 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListQueueServices', pipeline_response) @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -132,40 +130,28 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueueServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -174,8 +160,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -202,35 +191,23 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -239,4 +216,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py index 9250537c5fdb..0724b60000da 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py index f4380271a954..9934023f188a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_04_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_04_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_04_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -323,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -396,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -445,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -516,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -593,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -605,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -661,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_04_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountListKeysResult @@ -672,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -741,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -810,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -862,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -893,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -912,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -934,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -960,6 +892,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore async def _restore_blob_ranges_initial( @@ -974,32 +907,22 @@ async def _restore_blob_ranges_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1017,8 +940,11 @@ async def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async async def begin_restore_blob_ranges( self, resource_group_name: str, @@ -1039,15 +965,20 @@ async def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_04_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1059,27 +990,21 @@ async def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1091,8 +1016,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -1118,25 +1045,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1148,3 +1067,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py index ab2f3fc20397..8424f123fb22 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -71,34 +77,24 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -107,8 +103,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -139,34 +138,24 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -207,34 +199,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -243,8 +225,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -275,34 +260,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -310,6 +285,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -327,7 +304,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListTableResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -335,36 +313,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -377,12 +352,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py index dae40c4d10f8..46ce22c14dc0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListTableServices', pipeline_response) @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -132,40 +130,28 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TableServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -174,8 +160,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -202,35 +191,23 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -239,4 +216,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py index fab2699d7255..161eeda8c0fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_04_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py index 58081cde8167..500bda621a86 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py @@ -6,284 +6,145 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessPolicy - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobInventoryPolicy - from ._models_py3 import BlobInventoryPolicyDefinition - from ._models_py3 import BlobInventoryPolicyFilter - from ._models_py3 import BlobInventoryPolicyRule - from ._models_py3 import BlobInventoryPolicySchema - from ._models_py3 import BlobRestoreParameters - from ._models_py3 import BlobRestoreRange - from ._models_py3 import BlobRestoreStatus - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorAutoGenerated - from ._models_py3 import CloudErrorBody - from ._models_py3 import CloudErrorBodyAutoGenerated - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import DeletedAccount - from ._models_py3 import DeletedAccountListResult - from ._models_py3 import DeletedShare - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionIdentity - from ._models_py3 import EncryptionScope - from ._models_py3 import EncryptionScopeKeyVaultProperties - from ._models_py3 import EncryptionScopeListResult - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import ExtendedLocation - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import ImmutableStorageWithVersioning - from ._models_py3 import KeyCreationTime - from ._models_py3 import KeyPolicy - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LastAccessTimeTrackingPolicy - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LeaseShareRequest - from ._models_py3 import LeaseShareResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListBlobInventoryPolicy - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListQueue - from ._models_py3 import ListQueueResource - from ._models_py3 import ListQueueServices - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ListTableResource - from ._models_py3 import ListTableServices - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import ManagementPolicyVersion - from ._models_py3 import MetricSpecification - from ._models_py3 import Multichannel - from ._models_py3 import NetworkRuleSet - from ._models_py3 import ObjectReplicationPolicies - from ._models_py3 import ObjectReplicationPolicy - from ._models_py3 import ObjectReplicationPolicyFilter - from ._models_py3 import ObjectReplicationPolicyRule - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProtocolSettings - from ._models_py3 import ProxyResource - from ._models_py3 import QueueServiceProperties - from ._models_py3 import Resource - from ._models_py3 import ResourceAccessRule - from ._models_py3 import RestorePolicyProperties - from ._models_py3 import Restriction - from ._models_py3 import RoutingPreference - from ._models_py3 import SKUCapability - from ._models_py3 import SasPolicy - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import SignedIdentifier - from ._models_py3 import Sku - from ._models_py3 import SkuInformation - from ._models_py3 import SmbSetting - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountInternetEndpoints - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountMicrosoftEndpoints - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageQueue - from ._models_py3 import StorageSkuListResult - from ._models_py3 import SystemData - from ._models_py3 import Table - from ._models_py3 import TableServiceProperties - from ._models_py3 import TagFilter - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import UserAssignedIdentity - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccessPolicy # type: ignore - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobInventoryPolicy # type: ignore - from ._models import BlobInventoryPolicyDefinition # type: ignore - from ._models import BlobInventoryPolicyFilter # type: ignore - from ._models import BlobInventoryPolicyRule # type: ignore - from ._models import BlobInventoryPolicySchema # type: ignore - from ._models import BlobRestoreParameters # type: ignore - from ._models import BlobRestoreRange # type: ignore - from ._models import BlobRestoreStatus # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorAutoGenerated # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CloudErrorBodyAutoGenerated # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import DeletedAccount # type: ignore - from ._models import DeletedAccountListResult # type: ignore - from ._models import DeletedShare # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionIdentity # type: ignore - from ._models import EncryptionScope # type: ignore - from ._models import EncryptionScopeKeyVaultProperties # type: ignore - from ._models import EncryptionScopeListResult # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import ImmutableStorageWithVersioning # type: ignore - from ._models import KeyCreationTime # type: ignore - from ._models import KeyPolicy # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LastAccessTimeTrackingPolicy # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LeaseShareRequest # type: ignore - from ._models import LeaseShareResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListBlobInventoryPolicy # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListQueue # type: ignore - from ._models import ListQueueResource # type: ignore - from ._models import ListQueueServices # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ListTableResource # type: ignore - from ._models import ListTableServices # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import ManagementPolicyVersion # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import Multichannel # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import ObjectReplicationPolicies # type: ignore - from ._models import ObjectReplicationPolicy # type: ignore - from ._models import ObjectReplicationPolicyFilter # type: ignore - from ._models import ObjectReplicationPolicyRule # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProtocolSettings # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueueServiceProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceAccessRule # type: ignore - from ._models import RestorePolicyProperties # type: ignore - from ._models import Restriction # type: ignore - from ._models import RoutingPreference # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import SasPolicy # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import SignedIdentifier # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SmbSetting # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountInternetEndpoints # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountMicrosoftEndpoints # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageQueue # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import Table # type: ignore - from ._models import TableServiceProperties # type: ignore - from ._models import TagFilter # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import UserAssignedIdentity # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccessPolicy +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorAutoGenerated +from ._models_py3 import CloudErrorBody +from ._models_py3 import CloudErrorBodyAutoGenerated +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedAccount +from ._models_py3 import DeletedAccountListResult +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionIdentity +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import ImmutableStorageWithVersioning +from ._models_py3 import KeyCreationTime +from ._models_py3 import KeyPolicy +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LeaseShareRequest +from ._models_py3 import LeaseShareResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import Multichannel +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProtocolSettings +from ._models_py3 import ProxyResource +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceAccessRule +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import SasPolicy +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import SignedIdentifier +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import SmbSetting +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models.py deleted file mode 100644 index 91eabb7bbf9a..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models.py +++ /dev/null @@ -1,5726 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccessPolicy(msrest.serialization.Model): - """AccessPolicy. - - :param start_time: Start time of the access policy. - :type start_time: ~datetime.datetime - :param expiry_time: Expiry time of the access policy. - :type expiry_time: ~datetime.datetime - :param permission: List of abbreviated permissions. - :type permission: str - """ - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'permission': {'key': 'permission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessPolicy, self).__init__(**kwargs) - self.start_time = kwargs.get('start_time', None) - self.expiry_time = kwargs.get('expiry_time', None) - self.permission = kwargs.get('permission', None) - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_04_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2021_04_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2021_04_01.models.ActiveDirectoryProperties - :param default_share_permission: Default share permission for users using Kerberos - authentication if RBAC role is not assigned. Possible values include: "None", - "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", - "StorageFileDataSmbShareElevatedContributor", "StorageFileDataSmbShareOwner". - :type default_share_permission: str or - ~azure.mgmt.storage.v2021_04_01.models.DefaultSharePermission - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - 'default_share_permission': {'key': 'defaultSharePermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - self.default_share_permission = kwargs.get('default_share_permission', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_04_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the - container. The property is immutable and can only be set to true at the container creation - time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_04_01.models.ImmutableStorageWithVersioning - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageWithVersioning'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - - -class BlobInventoryPolicy(Resource): - """The storage account blob inventory policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.storage.v2021_04_01.models.SystemData - :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. - :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicy, self).__init__(**kwargs) - self.system_data = None - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class BlobInventoryPolicyDefinition(msrest.serialization.Model): - """An object that defines the blob inventory rule. - - All required parameters must be populated in order to send to Azure. - - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyFilter - :param format: Required. This is a required field, it specifies the format for the inventory - files. Possible values include: "Csv", "Parquet". - :type format: str or ~azure.mgmt.storage.v2021_04_01.models.Format - :param schedule: Required. This is a required field. This field is used to schedule an - inventory formation. Possible values include: "Daily", "Weekly". - :type schedule: str or ~azure.mgmt.storage.v2021_04_01.models.Schedule - :param object_type: Required. This is a required field. This field specifies the scope of the - inventory created either at the blob or container level. Possible values include: "Blob", - "Container". - :type object_type: str or ~azure.mgmt.storage.v2021_04_01.models.ObjectType - :param schema_fields: Required. This is a required field. This field specifies the fields and - properties of the object to be included in the inventory. The Schema field value 'Name' is - always required. The valid values for this field for the 'Blob' definition.objectType include - 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, - AccessTierChangeTime, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Snapshot, - VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid values for 'Container' - definition.objectType include 'Name, Last-Modified, Metadata, LeaseStatus, LeaseState, - LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. Schema field values - 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only for Hns enabled - accounts. - :type schema_fields: list[str] - """ - - _validation = { - 'format': {'required': True}, - 'schedule': {'required': True}, - 'object_type': {'required': True}, - 'schema_fields': {'required': True}, - } - - _attribute_map = { - 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, - 'format': {'key': 'format', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'schema_fields': {'key': 'schemaFields', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) - self.filters = kwargs.get('filters', None) - self.format = kwargs['format'] - self.schedule = kwargs['schedule'] - self.object_type = kwargs['object_type'] - self.schema_fields = kwargs['schema_fields'] - - -class BlobInventoryPolicyFilter(msrest.serialization.Model): - """An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. - - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: An array of predefined enum values. Valid values include blockBlob, - appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when - definition.objectType property is set to 'Blob'. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value is set to - true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this - property is set to true, else they must be excluded. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value is set to true. - The definition.schemaFields value 'Snapshot' is required if this property is set to true, else - it must be excluded. - :type include_snapshots: bool - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, - 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs.get('blob_types', None) - self.include_blob_versions = kwargs.get('include_blob_versions', None) - self.include_snapshots = kwargs.get('include_snapshots', None) - - -class BlobInventoryPolicyRule(msrest.serialization.Model): - """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param destination: Required. Container name where blob inventory files are stored. Must be - pre-created. - :type destination: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyDefinition - """ - - _validation = { - 'enabled': {'required': True}, - 'name': {'required': True}, - 'destination': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.name = kwargs['name'] - self.destination = kwargs['destination'] - self.definition = kwargs['definition'] - - -class BlobInventoryPolicySchema(msrest.serialization.Model): - """The storage account blob inventory policy rules. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied - when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyRule] - """ - - _validation = { - 'enabled': {'required': True}, - 'type': {'required': True}, - 'rules': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicySchema, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.type = kwargs['type'] - self.rules = kwargs['rules'] - - -class BlobRestoreParameters(msrest.serialization.Model): - """Blob restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreRange] - """ - - _validation = { - 'time_to_restore': {'required': True}, - 'blob_ranges': {'required': True}, - } - - _attribute_map = { - 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, - 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreParameters, self).__init__(**kwargs) - self.time_to_restore = kwargs['time_to_restore'] - self.blob_ranges = kwargs['blob_ranges'] - - -class BlobRestoreRange(msrest.serialization.Model): - """Blob range. - - All required parameters must be populated in order to send to Azure. - - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str - """ - - _validation = { - 'start_range': {'required': True}, - 'end_range': {'required': True}, - } - - _attribute_map = { - 'start_range': {'key': 'startRange', 'type': 'str'}, - 'end_range': {'key': 'endRange', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreRange, self).__init__(**kwargs) - self.start_range = kwargs['start_range'] - self.end_range = kwargs['end_range'] - - -class BlobRestoreStatus(msrest.serialization.Model): - """Blob restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates - that blob restore is ongoing. - Complete: Indicates that blob restore has been completed - successfully. - Failed: Indicates that blob restore is failed. Possible values include: - "InProgress", "Complete", "Failed". - :vartype status: str or ~azure.mgmt.storage.v2021_04_01.models.BlobRestoreProgressStatus - :ivar failure_reason: Failure reason when blob restore is failed. - :vartype failure_reason: str - :ivar restore_id: Id for tracking blob restore request. - :vartype restore_id: str - :ivar parameters: Blob restore request parameters. - :vartype parameters: ~azure.mgmt.storage.v2021_04_01.models.BlobRestoreParameters - """ - - _validation = { - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'restore_id': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - 'restore_id': {'key': 'restoreId', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreStatus, self).__init__(**kwargs) - self.status = None - self.failure_reason = None - self.restore_id = None - self.parameters = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_04_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_04_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: - ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: - ~azure.mgmt.storage.v2021_04_01.models.LastAccessTimeTrackingPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, - 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.is_versioning_enabled = kwargs.get('is_versioning_enabled', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - self.restore_policy = kwargs.get('restore_policy', None) - self.container_delete_retention_policy = kwargs.get('container_delete_retention_policy', None) - self.last_access_time_tracking_policy = kwargs.get('last_access_time_tracking_policy', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value - is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite - retention of the change feed. - :type retention_in_days: int - """ - - _validation = { - 'retention_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.retention_in_days = kwargs.get('retention_in_days', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2021_04_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorAutoGenerated(msrest.serialization.Model): - """An error response from the Storage service. - - :param error: An error response from the Storage service. - :type error: ~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBodyAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorAutoGenerated, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CloudErrorBodyAutoGenerated(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBodyAutoGenerated]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBodyAutoGenerated, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2021_04_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2021_04_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - - :param days_after_modification_greater_than: Value indicating the age in days after last - modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last - blob access. This property can only be used in conjunction with last access time tracking - policy. - :type days_after_last_access_time_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, - 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) - self.days_after_last_access_time_greater_than = kwargs.get('days_after_last_access_time_greater_than', None) - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class DeletedAccount(ProxyResource): - """Deleted storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar storage_account_resource_id: Full resource id of the original storage account. - :vartype storage_account_resource_id: str - :ivar location: Location of the deleted account. - :vartype location: str - :ivar restore_reference: Can be used to attempt recovering this deleted account via - PutStorageAccount API. - :vartype restore_reference: str - :ivar creation_time: Creation time of the deleted account. - :vartype creation_time: str - :ivar deletion_time: Deletion time of the deleted account. - :vartype deletion_time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'storage_account_resource_id': {'readonly': True}, - 'location': {'readonly': True}, - 'restore_reference': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'deletion_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'restore_reference': {'key': 'properties.restoreReference', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'deletion_time': {'key': 'properties.deletionTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccount, self).__init__(**kwargs) - self.storage_account_resource_id = None - self.location = None - self.restore_reference = None - self.creation_time = None - self.deletion_time = None - - -class DeletedAccountListResult(msrest.serialization.Model): - """The response from the List Deleted Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of deleted accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.DeletedAccount] - :ivar next_link: Request URL that can be used to query next page of deleted accounts. Returned - when total number of requested deleted accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DeletedShare(msrest.serialization.Model): - """The deleted share to be restored. - - All required parameters must be populated in order to send to Azure. - - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will - be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str - """ - - _validation = { - 'deleted_share_name': {'required': True}, - 'deleted_share_version': {'required': True}, - } - - _attribute_map = { - 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, - 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedShare, self).__init__(**kwargs) - self.deleted_share_name = kwargs['deleted_share_name'] - self.deleted_share_version = kwargs['deleted_share_version'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_04_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_04_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_04_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_04_01.models.EncryptionIdentity - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - 'encryption_identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.encryption_identity = kwargs.get('encryption_identity', None) - - -class EncryptionIdentity(msrest.serialization.Model): - """Encryption identity for the storage account. - - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str - """ - - _attribute_map = { - 'encryption_user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionIdentity, self).__init__(**kwargs) - self.encryption_user_assigned_identity = kwargs.get('encryption_user_assigned_identity', None) - - -class EncryptionScope(Resource): - """The Encryption Scope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): - Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", - "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, - Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeState - :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modification date and time of the encryption scope in - UTC. - :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a - required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: - ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, - 'require_infrastructure_encryption': {'key': 'properties.requireInfrastructureEncryption', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScope, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.state = kwargs.get('state', None) - self.creation_time = None - self.last_modified_time = None - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - - -class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): - """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_uri: The object identifier for a key vault key object. When applied, the encryption - scope will use the key referenced by the identifier to enable customer-managed key support on - this encryption scope. - :type key_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class EncryptionScopeListResult(msrest.serialization.Model): - """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of encryption scopes requested. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.EncryptionScope] - :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned - when total number of requested encryption scopes exceeds the maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type - implies that an account-scoped encryption key will be used. 'Service' key type implies that a - default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_04_01.models.KeyType - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - self.key_type = kwargs.get('key_type', None) - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = kwargs.get('table', None) - self.queue = kwargs.get('queue', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: - ~azure.mgmt.storage.v2021_04_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: - ~azure.mgmt.storage.v2021_04_01.models.StorageAccountInternetEndpoints - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, - 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - self.microsoft_endpoints = kwargs.get('microsoft_endpoints', None) - self.internet_endpoints = kwargs.get('internet_endpoints', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the storage resource provider. - - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_04_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body contract. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExtendedLocation(msrest.serialization.Model): - """The complex type of the extended location. - - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocationTypes - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: - ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_04_01.models.ProtocolSettings - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'protocol_settings': {'key': 'properties.protocolSettings', 'type': 'ProtocolSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.share_delete_retention_policy = kwargs.get('share_delete_retention_policy', None) - self.protocol_settings = kwargs.get('protocol_settings', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar lease_status: The lease status of the share. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseStatus - :ivar lease_state: Lease state of the share. Possible values include: "Available", "Leased", - "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, - only when the share is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'signed_identifiers': {'key': 'properties.signedIdentifiers', 'type': '[SignedIdentifier]'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.signed_identifiers = kwargs.get('signed_identifiers', None) - self.snapshot_time = None - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar lease_status: The lease status of the share. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseStatus - :ivar lease_state: Lease state of the share. Possible values include: "Available", "Leased", - "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, - only when the share is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'signed_identifiers': {'key': 'properties.signedIdentifiers', 'type': '[SignedIdentifier]'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.signed_identifiers = kwargs.get('signed_identifiers', None) - self.snapshot_time = None - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2021_04_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM - resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, - ~azure.mgmt.storage.v2021_04_01.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': 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': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2021_04_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class ImmutableStorageWithVersioning(msrest.serialization.Model): - """Object level immutability properties of the container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: This is an immutable property, when set to true it enables object level - immutability at the container level. - :type enabled: bool - :ivar time_stamp: Returns the date and time the object level immutability was enabled. - :vartype time_stamp: ~datetime.datetime - :ivar migration_state: This property denotes the container level immutability to object level - immutability migration state. Possible values include: "InProgress", "Completed". - :vartype migration_state: str or ~azure.mgmt.storage.v2021_04_01.models.MigrationState - """ - - _validation = { - 'time_stamp': {'readonly': True}, - 'migration_state': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, - 'migration_state': {'key': 'migrationState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutableStorageWithVersioning, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.time_stamp = None - self.migration_state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyCreationTime(msrest.serialization.Model): - """Storage account keys creation time. - - :param key1: - :type key1: ~datetime.datetime - :param key2: - :type key2: ~datetime.datetime - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'iso-8601'}, - 'key2': {'key': 'key2', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyCreationTime, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) - - -class KeyPolicy(msrest.serialization.Model): - """KeyPolicy assigned to the storage account. - - All required parameters must be populated in order to send to Azure. - - :param key_expiration_period_in_days: Required. The key expiration period in days. - :type key_expiration_period_in_days: int - """ - - _validation = { - 'key_expiration_period_in_days': {'required': True}, - } - - _attribute_map = { - 'key_expiration_period_in_days': {'key': 'keyExpirationPeriodInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyPolicy, self).__init__(**kwargs) - self.key_expiration_period_in_days = kwargs['key_expiration_period_in_days'] - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class LastAccessTimeTrackingPolicy(msrest.serialization.Model): - """The blob service properties for Last access time based tracking policy. - - All required parameters must be populated in order to send to Azure. - - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently - read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_04_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in - days, typically how often the blob object should be tracked.This field is currently read only - with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported - value. This field is currently read only. - :type blob_type: list[str] - """ - - _validation = { - 'enable': {'required': True}, - } - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, - 'blob_type': {'key': 'blobType', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) - self.enable = kwargs['enable'] - self.name = kwargs.get('name', None) - self.tracking_granularity_in_days = kwargs.get('tracking_granularity_in_days', None) - self.blob_type = kwargs.get('blob_type', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LeaseShareRequest(msrest.serialization.Model): - """Lease Share request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseShareAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseShareRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseShareResponse(msrest.serialization.Model): - """Lease Share response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - share, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseShareResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_04_01.models.TagProperty] - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListBlobInventoryPolicy(msrest.serialization.Model): - """List of blob inventory policies returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob inventory policies. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListBlobInventoryPolicy, self).__init__(**kwargs) - self.value = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_04_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the - container. The property is immutable and can only be set to true at the container creation - time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_04_01.models.ImmutableStorageWithVersioning - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageWithVersioning'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueue(Resource): - """ListQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - - -class ListQueueResource(msrest.serialization.Model): - """Response schema. Contains list of queues returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queues returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.ListQueue] - :ivar next_link: Request URL that can be used to list next page of queues. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueueServices(msrest.serialization.Model): - """ListQueueServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queue services returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.QueueServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueServices, self).__init__(**kwargs) - self.value = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ListTableResource(msrest.serialization.Model): - """Response schema. Contains list of tables returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of tables returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.Table] - :ivar next_link: Request URL that can be used to query next page of tables. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Table]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListTableServices(msrest.serialization.Model): - """ListTableServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of table services returned. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.TableServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableServices, self).__init__(**kwargs) - self.value = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyVersion - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - self.version = kwargs.get('version', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - self.enable_auto_tier_to_hot_from_cool = kwargs.get('enable_auto_tier_to_hot_from_cool', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports - all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag - filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_04_01.models.TagFilter] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.blob_index_match = kwargs.get('blob_index_match', None) - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyVersion(msrest.serialization.Model): - """Management policy action for blob version. - - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob - version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyVersion, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_04_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class Multichannel(msrest.serialization.Model): - """Multichannel setting. Applies to Premium FileStorage only. - - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Multichannel, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_04_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_04_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_04_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_04_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_04_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'resource_access_rules': {'key': 'resourceAccessRules', 'type': '[ResourceAccessRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.resource_access_rules = kwargs.get('resource_access_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class ObjectReplicationPolicies(msrest.serialization.Model): - """List storage account object replication policies. - - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicies, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ObjectReplicationPolicy(Resource): - """The replication policy between two storage accounts. Multiple rules can be defined in one policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar policy_id: A unique id for object replication policy. - :vartype policy_id: str - :ivar enabled_time: Indicates when the policy is enabled on the source account. - :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. It should be full resource id if - allowCrossTenantReplication set to false. - :type source_account: str - :param destination_account: Required. Destination account name. It should be full resource id - if allowCrossTenantReplication set to false. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyRule] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, - 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, - 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicy, self).__init__(**kwargs) - self.policy_id = None - self.enabled_time = None - self.source_account = kwargs.get('source_account', None) - self.destination_account = kwargs.get('destination_account', None) - self.rules = kwargs.get('rules', None) - - -class ObjectReplicationPolicyFilter(msrest.serialization.Model): - """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin - with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.min_creation_time = kwargs.get('min_creation_time', None) - - -class ObjectReplicationPolicyRule(msrest.serialization.Model): - """The replication policy rule between two containers. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is - required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyFilter - """ - - _validation = { - 'source_container': {'required': True}, - 'destination_container': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'source_container': {'key': 'sourceContainer', 'type': 'str'}, - 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyRule, self).__init__(**kwargs) - self.rule_id = kwargs.get('rule_id', None) - self.source_container = kwargs['source_container'] - self.destination_container = kwargs['destination_container'] - self.filters = kwargs.get('filters', None) - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_04_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_04_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :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(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storage.v2021_04_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type action_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class ProtocolSettings(msrest.serialization.Model): - """Protocol settings for file service. - - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_04_01.models.SmbSetting - """ - - _attribute_map = { - 'smb': {'key': 'smb', 'type': 'SmbSetting'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtocolSettings, self).__init__(**kwargs) - self.smb = kwargs.get('smb', None) - - -class QueueServiceProperties(Resource): - """The properties of a storage account’s Queue service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(QueueServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class ResourceAccessRule(msrest.serialization.Model): - """Resource Access Rule. - - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceAccessRule, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.resource_id = kwargs.get('resource_id', None) - - -class RestorePolicyProperties(msrest.serialization.Model): - """The blob service properties for blob restore policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than - DeleteRetentionPolicy.days. - :type days: int - :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. - :vartype last_enabled_time: ~datetime.datetime - :ivar min_restore_time: Returns the minimum date and time that the restore can be started. - :vartype min_restore_time: ~datetime.datetime - """ - - _validation = { - 'enabled': {'required': True}, - 'days': {'maximum': 365, 'minimum': 1}, - 'last_enabled_time': {'readonly': True}, - 'min_restore_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePolicyProperties, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs.get('days', None) - self.last_enabled_time = None - self.min_restore_time = None - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_04_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class RoutingPreference(msrest.serialization.Model): - """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. - Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_04_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing - storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing - storage endpoints are to be published. - :type publish_internet_endpoints: bool - """ - - _attribute_map = { - 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, - 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, - 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingPreference, self).__init__(**kwargs) - self.routing_choice = kwargs.get('routing_choice', None) - self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) - self.publish_internet_endpoints = kwargs.get('publish_internet_endpoints', None) - - -class SasPolicy(msrest.serialization.Model): - """SasPolicy assigned to the storage account. - - All required parameters must be populated in order to send to Azure. - - :param sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. - :type sas_expiration_period: str - :param expiration_action: Required. The SAS expiration action. Can only be Log. Possible values - include: "Log". Default value: "Log". - :type expiration_action: str or ~azure.mgmt.storage.v2021_04_01.models.ExpirationAction - """ - - _validation = { - 'sas_expiration_period': {'required': True}, - 'expiration_action': {'required': True}, - } - - _attribute_map = { - 'sas_expiration_period': {'key': 'sasExpirationPeriod', 'type': 'str'}, - 'expiration_action': {'key': 'expirationAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SasPolicy, self).__init__(**kwargs) - self.sas_expiration_period = kwargs['sas_expiration_period'] - self.expiration_action = kwargs.get('expiration_action', "Log") - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_04_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class SignedIdentifier(msrest.serialization.Model): - """SignedIdentifier. - - :param id: An unique identifier of the stored access policy. - :type id: str - :param access_policy: Access policy. - :type access_policy: ~azure.mgmt.storage.v2021_04_01.models.AccessPolicy - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'access_policy': {'key': 'accessPolicy', 'type': 'AccessPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(SignedIdentifier, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.access_policy = kwargs.get('access_policy', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_04_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuInformation(msrest.serialization.Model): - """Storage SKU and its 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. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_04_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2021_04_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_04_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SmbSetting(msrest.serialization.Model): - """Setting for SMB protocol. - - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_04_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, - SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are - NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values - are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are - AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str - """ - - _attribute_map = { - 'multichannel': {'key': 'multichannel', 'type': 'Multichannel'}, - 'versions': {'key': 'versions', 'type': 'str'}, - 'authentication_methods': {'key': 'authenticationMethods', 'type': 'str'}, - 'kerberos_ticket_encryption': {'key': 'kerberosTicketEncryption', 'type': 'str'}, - 'channel_encryption': {'key': 'channelEncryption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SmbSetting, self).__init__(**kwargs) - self.multichannel = kwargs.get('multichannel', None) - self.versions = kwargs.get('versions', None) - self.authentication_methods = kwargs.get('authentication_methods', None) - self.kerberos_ticket_encryption = kwargs.get('kerberos_ticket_encryption', None) - self.channel_encryption = kwargs.get('channel_encryption', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_04_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_04_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2021_04_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2021_04_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2021_04_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain - :ivar sas_policy: SasPolicy assigned to the storage account. - :vartype sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy - :ivar key_policy: KeyPolicy assigned to the storage account. - :vartype key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy - :ivar key_creation_time: Storage account keys creation time. - :vartype key_creation_time: ~azure.mgmt.storage.v2021_04_01.models.KeyCreationTime - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2021_04_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_04_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage account. - :vartype private_endpoint_connections: - list[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference - :ivar blob_restore_status: Blob restore status. - :vartype blob_restore_status: ~azure.mgmt.storage.v2021_04_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. - The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'sas_policy': {'readonly': True}, - 'key_policy': {'readonly': True}, - 'key_creation_time': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'blob_restore_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'key_creation_time': {'key': 'properties.keyCreationTime', 'type': 'KeyCreationTime'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.extended_location = kwargs.get('extended_location', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.sas_policy = None - self.key_policy = None - self.key_creation_time = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.private_endpoint_connections = None - self.routing_preference = kwargs.get('routing_preference', None) - self.blob_restore_status = None - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - self.allow_cross_tenant_replication = kwargs.get('allow_cross_tenant_replication', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the - storage account will be created in Azure main region. Otherwise it will be created in the - specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_04_01.models.Identity - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. - The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.extended_location = kwargs.get('extended_location', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.sas_policy = kwargs.get('sas_policy', None) - self.key_policy = kwargs.get('key_policy', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - self.allow_cross_tenant_replication = kwargs.get('allow_cross_tenant_replication', None) - - -class StorageAccountInternetEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountInternetEndpoints, self).__init__(**kwargs) - self.blob = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2021_04_01.models.KeyPermission - :ivar creation_time: Creation time of the key, in round trip date format. - :vartype creation_time: ~datetime.datetime - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - 'creation_time': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - self.creation_time = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2021_04_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_04_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. - The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.sas_policy = kwargs.get('sas_policy', None) - self.key_policy = kwargs.get('key_policy', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.allow_cross_tenant_replication = kwargs.get('allow_cross_tenant_replication', None) - - -class StorageQueue(Resource): - """StorageQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - :ivar approximate_message_count: Integer indicating an approximate number of messages in the - queue. This number is not lower than the actual number of messages in the queue, but could be - higher. - :vartype approximate_message_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'approximate_message_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - self.approximate_message_count = None - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.SkuInformation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_04_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_04_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Table(Resource): - """Properties of the table, including Id, resource name, resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar table_name: Table name under the specified account. - :vartype table_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'table_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Table, self).__init__(**kwargs) - self.table_name = None - - -class TableServiceProperties(Resource): - """The properties of a storage account’s Table service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(TableServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class TagFilter(msrest.serialization.Model): - """Blob index tag based filtering for blob objects. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and - filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can - have 0 - 256 characters. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 128, 'min_length': 1}, - 'op': {'required': True}, - 'value': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'op': {'key': 'op', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagFilter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.op = kwargs['op'] - self.value = kwargs['value'] - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2021_04_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2021_04_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the identity. - :vartype principal_id: str - :ivar client_id: The client ID of the identity. - :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(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "Provisioning", - "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_04_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py index 606d5e5a1d72..c1cb0392e6bf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py @@ -18,12 +18,12 @@ class AccessPolicy(msrest.serialization.Model): """AccessPolicy. - :param start_time: Start time of the access policy. - :type start_time: ~datetime.datetime - :param expiry_time: Expiry time of the access policy. - :type expiry_time: ~datetime.datetime - :param permission: List of abbreviated permissions. - :type permission: str + :ivar start_time: Start time of the access policy. + :vartype start_time: ~datetime.datetime + :ivar expiry_time: Expiry time of the access policy. + :vartype expiry_time: ~datetime.datetime + :ivar permission: List of abbreviated permissions. + :vartype permission: str """ _attribute_map = { @@ -40,6 +40,14 @@ def __init__( permission: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Start time of the access policy. + :paramtype start_time: ~datetime.datetime + :keyword expiry_time: Expiry time of the access policy. + :paramtype expiry_time: ~datetime.datetime + :keyword permission: List of abbreviated permissions. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start_time = start_time self.expiry_time = expiry_time @@ -51,31 +59,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_04_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2021_04_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -109,6 +117,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2021_04_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -125,19 +161,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -169,6 +205,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -209,6 +261,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -250,6 +304,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -259,18 +315,18 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2021_04_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2021_04_01.models.ActiveDirectoryProperties - :param default_share_permission: Default share permission for users using Kerberos + :ivar default_share_permission: Default share permission for users using Kerberos authentication if RBAC role is not assigned. Possible values include: "None", "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", "StorageFileDataSmbShareElevatedContributor", "StorageFileDataSmbShareOwner". - :type default_share_permission: str or + :vartype default_share_permission: str or ~azure.mgmt.storage.v2021_04_01.models.DefaultSharePermission """ @@ -292,6 +348,21 @@ def __init__( default_share_permission: Optional[Union[str, "DefaultSharePermission"]] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2021_04_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2021_04_01.models.ActiveDirectoryProperties + :keyword default_share_permission: Default share permission for users using Kerberos + authentication if RBAC role is not assigned. Possible values include: "None", + "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", + "StorageFileDataSmbShareElevatedContributor", "StorageFileDataSmbShareOwner". + :paramtype default_share_permission: str or + ~azure.mgmt.storage.v2021_04_01.models.DefaultSharePermission + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -321,15 +392,15 @@ class BlobContainer(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -341,8 +412,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyProperties @@ -357,10 +428,10 @@ class BlobContainer(AzureEntityResource): if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container. :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the + :ivar immutable_storage_with_versioning: The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_04_01.models.ImmutableStorageWithVersioning """ @@ -417,6 +488,24 @@ def __init__( immutable_storage_with_versioning: Optional["ImmutableStorageWithVersioning"] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + :keyword immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_04_01.models.ImmutableStorageWithVersioning + """ super(BlobContainer, self).__init__(**kwargs) self.version = None self.deleted = None @@ -454,9 +543,8 @@ class BlobInventoryPolicy(Resource): :vartype system_data: ~azure.mgmt.storage.v2021_04_01.models.SystemData :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicySchema + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicySchema """ _validation = { @@ -482,6 +570,11 @@ def __init__( policy: Optional["BlobInventoryPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicySchema + """ super(BlobInventoryPolicy, self).__init__(**kwargs) self.system_data = None self.last_modified_time = None @@ -493,19 +586,19 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyFilter - :param format: Required. This is a required field, it specifies the format for the inventory + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyFilter + :ivar format: Required. This is a required field, it specifies the format for the inventory files. Possible values include: "Csv", "Parquet". - :type format: str or ~azure.mgmt.storage.v2021_04_01.models.Format - :param schedule: Required. This is a required field. This field is used to schedule an - inventory formation. Possible values include: "Daily", "Weekly". - :type schedule: str or ~azure.mgmt.storage.v2021_04_01.models.Schedule - :param object_type: Required. This is a required field. This field specifies the scope of the + :vartype format: str or ~azure.mgmt.storage.v2021_04_01.models.Format + :ivar schedule: Required. This is a required field. This field is used to schedule an inventory + formation. Possible values include: "Daily", "Weekly". + :vartype schedule: str or ~azure.mgmt.storage.v2021_04_01.models.Schedule + :ivar object_type: Required. This is a required field. This field specifies the scope of the inventory created either at the blob or container level. Possible values include: "Blob", "Container". - :type object_type: str or ~azure.mgmt.storage.v2021_04_01.models.ObjectType - :param schema_fields: Required. This is a required field. This field specifies the fields and + :vartype object_type: str or ~azure.mgmt.storage.v2021_04_01.models.ObjectType + :ivar schema_fields: Required. This is a required field. This field specifies the fields and properties of the object to be included in the inventory. The Schema field value 'Name' is always required. The valid values for this field for the 'Blob' definition.objectType include 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, @@ -515,7 +608,7 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only for Hns enabled accounts. - :type schema_fields: list[str] + :vartype schema_fields: list[str] """ _validation = { @@ -543,6 +636,31 @@ def __init__( filters: Optional["BlobInventoryPolicyFilter"] = None, **kwargs ): + """ + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyFilter + :keyword format: Required. This is a required field, it specifies the format for the inventory + files. Possible values include: "Csv", "Parquet". + :paramtype format: str or ~azure.mgmt.storage.v2021_04_01.models.Format + :keyword schedule: Required. This is a required field. This field is used to schedule an + inventory formation. Possible values include: "Daily", "Weekly". + :paramtype schedule: str or ~azure.mgmt.storage.v2021_04_01.models.Schedule + :keyword object_type: Required. This is a required field. This field specifies the scope of the + inventory created either at the blob or container level. Possible values include: "Blob", + "Container". + :paramtype object_type: str or ~azure.mgmt.storage.v2021_04_01.models.ObjectType + :keyword schema_fields: Required. This is a required field. This field specifies the fields and + properties of the object to be included in the inventory. The Schema field value 'Name' is + always required. The valid values for this field for the 'Blob' definition.objectType include + 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, + AccessTierChangeTime, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Snapshot, + VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid values for 'Container' + definition.objectType include 'Name, Last-Modified, Metadata, LeaseStatus, LeaseState, + LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. Schema field values + 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only for Hns enabled + accounts. + :paramtype schema_fields: list[str] + """ super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) self.filters = filters self.format = format @@ -554,20 +672,20 @@ def __init__( class BlobInventoryPolicyFilter(msrest.serialization.Model): """An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: An array of predefined enum values. Valid values include blockBlob, + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: An array of predefined enum values. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when definition.objectType property is set to 'Blob'. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value is set to + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value is set to true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this property is set to true, else they must be excluded. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value is set to true. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value is set to true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, else it must be excluded. - :type include_snapshots: bool + :vartype include_snapshots: bool """ _attribute_map = { @@ -586,6 +704,22 @@ def __init__( include_snapshots: Optional[bool] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when + definition.objectType property is set to 'Blob'. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value is set to + true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this + property is set to true, else they must be excluded. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value is set to + true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, + else it must be excluded. + :paramtype include_snapshots: bool + """ super(BlobInventoryPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -598,16 +732,16 @@ class BlobInventoryPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param destination: Required. Container name where blob inventory files are stored. Must be + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar destination: Required. Container name where blob inventory files are stored. Must be pre-created. - :type destination: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyDefinition + :vartype destination: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyDefinition """ _validation = { @@ -633,6 +767,18 @@ def __init__( definition: "BlobInventoryPolicyDefinition", **kwargs ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyDefinition + """ super(BlobInventoryPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -645,13 +791,13 @@ class BlobInventoryPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2021_04_01.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyRule] """ _validation = { @@ -674,6 +820,15 @@ def __init__( rules: List["BlobInventoryPolicyRule"], **kwargs ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2021_04_01.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyRule] + """ super(BlobInventoryPolicySchema, self).__init__(**kwargs) self.enabled = enabled self.type = type @@ -685,10 +840,10 @@ class BlobRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreRange] + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreRange] """ _validation = { @@ -708,6 +863,12 @@ def __init__( blob_ranges: List["BlobRestoreRange"], **kwargs ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreRange] + """ super(BlobRestoreParameters, self).__init__(**kwargs) self.time_to_restore = time_to_restore self.blob_ranges = blob_ranges @@ -718,10 +879,10 @@ class BlobRestoreRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str """ _validation = { @@ -741,6 +902,12 @@ def __init__( end_range: str, **kwargs ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ super(BlobRestoreRange, self).__init__(**kwargs) self.start_range = start_range self.end_range = end_range @@ -782,6 +949,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -810,6 +979,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -829,31 +1000,30 @@ class BlobServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_04_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_04_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2021_04_01.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2021_04_01.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: ~azure.mgmt.storage.v2021_04_01.models.LastAccessTimeTrackingPolicy """ @@ -894,6 +1064,36 @@ def __init__( last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2021_04_01.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: ~azure.mgmt.storage.v2021_04_01.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2021_04_01.models.LastAccessTimeTrackingPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -910,12 +1110,12 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - :type retention_in_days: int + :vartype retention_in_days: int """ _validation = { @@ -934,6 +1134,14 @@ def __init__( retention_in_days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled self.retention_in_days = retention_in_days @@ -972,6 +1180,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -981,8 +1191,8 @@ def __init__( class CloudErrorAutoGenerated(msrest.serialization.Model): """An error response from the Storage service. - :param error: An error response from the Storage service. - :type error: ~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated + :ivar error: An error response from the Storage service. + :vartype error: ~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated """ _attribute_map = { @@ -995,6 +1205,10 @@ def __init__( error: Optional["CloudErrorBodyAutoGenerated"] = None, **kwargs ): + """ + :keyword error: An error response from the Storage service. + :paramtype error: ~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated + """ super(CloudErrorAutoGenerated, self).__init__(**kwargs) self.error = error @@ -1002,17 +1216,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBody] """ _attribute_map = { @@ -1031,6 +1245,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1041,17 +1268,17 @@ def __init__( class CloudErrorBodyAutoGenerated(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated] """ _attribute_map = { @@ -1070,6 +1297,19 @@ def __init__( details: Optional[List["CloudErrorBodyAutoGenerated"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_04_01.models.CloudErrorBodyAutoGenerated] + """ super(CloudErrorBodyAutoGenerated, self).__init__(**kwargs) self.code = code self.message = message @@ -1082,22 +1322,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2021_04_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -1126,6 +1366,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2021_04_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -1137,9 +1395,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2021_04_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2021_04_01.models.CorsRule] """ _attribute_map = { @@ -1152,6 +1410,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2021_04_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -1161,12 +1424,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -1185,6 +1448,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -1195,9 +1466,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -1214,6 +1485,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -1221,13 +1497,13 @@ def __init__( class DateAfterModification(msrest.serialization.Model): """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - :param days_after_modification_greater_than: Value indicating the age in days after last + :ivar days_after_modification_greater_than: Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy. - :type days_after_last_access_time_greater_than: float + :vartype days_after_last_access_time_greater_than: float """ _validation = { @@ -1247,6 +1523,15 @@ def __init__( days_after_last_access_time_greater_than: Optional[float] = None, **kwargs ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than @@ -1283,6 +1568,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1338,6 +1625,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1372,6 +1661,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1382,12 +1673,12 @@ class DeletedShare(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str """ _validation = { @@ -1407,6 +1698,14 @@ def __init__( deleted_share_version: str, **kwargs ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ super(DeletedShare, self).__init__(**kwargs) self.deleted_share_name = deleted_share_name self.deleted_share_version = deleted_share_version @@ -1415,11 +1714,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -1438,6 +1737,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1446,10 +1752,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1464,6 +1770,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1474,19 +1786,19 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_04_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2021_04_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_04_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :vartype key_source: str or ~azure.mgmt.storage.v2021_04_01.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_04_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_04_01.models.EncryptionIdentity + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_04_01.models.KeyVaultProperties + :ivar encryption_identity: The identity to be used with service-side encryption at rest. + :vartype encryption_identity: ~azure.mgmt.storage.v2021_04_01.models.EncryptionIdentity """ _validation = { @@ -1511,6 +1823,21 @@ def __init__( encryption_identity: Optional["EncryptionIdentity"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2021_04_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2021_04_01.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2021_04_01.models.KeyVaultProperties + :keyword encryption_identity: The identity to be used with service-side encryption at rest. + :paramtype encryption_identity: ~azure.mgmt.storage.v2021_04_01.models.EncryptionIdentity + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -1522,9 +1849,9 @@ def __init__( class EncryptionIdentity(msrest.serialization.Model): """Encryption identity for the storage account. - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str + :ivar encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to be + associated with server-side encryption on the storage account. + :vartype encryption_user_assigned_identity: str """ _attribute_map = { @@ -1537,6 +1864,11 @@ def __init__( encryption_user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to + be associated with server-side encryption on the storage account. + :paramtype encryption_user_assigned_identity: str + """ super(EncryptionIdentity, self).__init__(**kwargs) self.encryption_user_assigned_identity = encryption_user_assigned_identity @@ -1554,25 +1886,25 @@ class EncryptionScope(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + :vartype source: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeState + :vartype state: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeState :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. :vartype creation_time: ~datetime.datetime :ivar last_modified_time: Gets the last modification date and time of the encryption scope in UTC. :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool + :vartype require_infrastructure_encryption: bool """ _validation = { @@ -1604,6 +1936,22 @@ def __init__( require_infrastructure_encryption: Optional[bool] = None, **kwargs ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeKeyVaultProperties + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + """ super(EncryptionScope, self).__init__(**kwargs) self.source = source self.state = state @@ -1618,10 +1966,10 @@ class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_uri: The object identifier for a key vault key object. When applied, the encryption + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - :type key_uri: str + :vartype key_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -1646,6 +1994,12 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri self.current_versioned_key_identifier = None @@ -1678,6 +2032,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1688,17 +2044,17 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_04_01.models.KeyType + :vartype key_type: str or ~azure.mgmt.storage.v2021_04_01.models.KeyType """ _validation = { @@ -1718,6 +2074,15 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2021_04_01.models.KeyType + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -1727,14 +2092,14 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService """ _attribute_map = { @@ -1753,6 +2118,16 @@ def __init__( queue: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2021_04_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -1777,11 +2152,11 @@ class Endpoints(msrest.serialization.Model): :vartype web: str :ivar dfs: Gets the dfs endpoint. :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountInternetEndpoints """ @@ -1812,6 +2187,14 @@ def __init__( internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, **kwargs ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2021_04_01.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2021_04_01.models.StorageAccountInternetEndpoints + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -1826,8 +2209,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the storage resource provider. - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_04_01.models.ErrorResponseBody + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2021_04_01.models.ErrorResponseBody """ _attribute_map = { @@ -1840,6 +2223,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2021_04_01.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1847,12 +2234,12 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body contract. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1867,6 +2254,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1875,10 +2270,10 @@ def __init__( class ExtendedLocation(msrest.serialization.Model): """The complex type of the extended location. - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -1893,6 +2288,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -1919,6 +2320,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1938,15 +2341,15 @@ class FileServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: + :vartype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_04_01.models.ProtocolSettings + :ivar protocol_settings: Protocol settings for file service. + :vartype protocol_settings: ~azure.mgmt.storage.v2021_04_01.models.ProtocolSettings """ _validation = { @@ -1974,6 +2377,17 @@ def __init__( protocol_settings: Optional["ProtocolSettings"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2021_04_01.models.DeleteRetentionPolicy + :keyword protocol_settings: Protocol settings for file service. + :paramtype protocol_settings: ~azure.mgmt.storage.v2021_04_01.models.ProtocolSettings + """ super(FileServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -1998,17 +2412,17 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -2017,10 +2431,10 @@ class FileShare(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2037,8 +2451,8 @@ class FileShare(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] + :ivar signed_identifiers: List of stored access policies specified on the share. + :vartype signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares with expand param "snapshots". :vartype snapshot_time: ~datetime.datetime @@ -2100,6 +2514,25 @@ def __init__( signed_identifiers: Optional[List["SignedIdentifier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier + :keyword signed_identifiers: List of stored access policies specified on the share. + :paramtype signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2138,17 +2571,17 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -2157,10 +2590,10 @@ class FileShareItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2177,8 +2610,8 @@ class FileShareItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] + :ivar signed_identifiers: List of stored access policies specified on the share. + :vartype signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares with expand param "snapshots". :vartype snapshot_time: ~datetime.datetime @@ -2240,6 +2673,25 @@ def __init__( signed_identifiers: Optional[List["SignedIdentifier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_04_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_04_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.ShareAccessTier + :keyword signed_identifiers: List of stored access policies specified on the share. + :paramtype signed_identifiers: list[~azure.mgmt.storage.v2021_04_01.models.SignedIdentifier] + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2287,6 +2739,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2330,6 +2784,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2347,13 +2803,13 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", + :ivar type: Required. The identity type. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM + :vartype type: str or ~azure.mgmt.storage.v2021_04_01.models.IdentityType + :ivar user_assigned_identities: Gets or sets a list of key value pairs that describe the set of + User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.storage.v2021_04_01.models.UserAssignedIdentity] """ @@ -2377,6 +2833,16 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: Required. The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.storage.v2021_04_01.models.IdentityType + :keyword user_assigned_identities: Gets or sets a list of key value pairs that describe the set + of User Assigned identities that will be used with this storage account. The key is the ARM + resource identifier of the identity. Only 1 User Assigned identity is permitted here. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.storage.v2021_04_01.models.UserAssignedIdentity] + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2399,18 +2865,18 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2438,6 +2904,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -2453,18 +2930,18 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2021_04_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -2488,6 +2965,17 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -2501,9 +2989,9 @@ class ImmutableStorageWithVersioning(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: This is an immutable property, when set to true it enables object level + :ivar enabled: This is an immutable property, when set to true it enables object level immutability at the container level. - :type enabled: bool + :vartype enabled: bool :ivar time_stamp: Returns the date and time the object level immutability was enabled. :vartype time_stamp: ~datetime.datetime :ivar migration_state: This property denotes the container level immutability to object level @@ -2528,6 +3016,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: This is an immutable property, when set to true it enables object level + immutability at the container level. + :paramtype enabled: bool + """ super(ImmutableStorageWithVersioning, self).__init__(**kwargs) self.enabled = enabled self.time_stamp = None @@ -2539,12 +3032,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -2563,6 +3056,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -2571,10 +3072,10 @@ def __init__( class KeyCreationTime(msrest.serialization.Model): """Storage account keys creation time. - :param key1: - :type key1: ~datetime.datetime - :param key2: - :type key2: ~datetime.datetime + :ivar key1: + :vartype key1: ~datetime.datetime + :ivar key2: + :vartype key2: ~datetime.datetime """ _attribute_map = { @@ -2589,6 +3090,12 @@ def __init__( key2: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ super(KeyCreationTime, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 @@ -2599,8 +3106,8 @@ class KeyPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_expiration_period_in_days: Required. The key expiration period in days. - :type key_expiration_period_in_days: int + :ivar key_expiration_period_in_days: Required. The key expiration period in days. + :vartype key_expiration_period_in_days: int """ _validation = { @@ -2617,6 +3124,10 @@ def __init__( key_expiration_period_in_days: int, **kwargs ): + """ + :keyword key_expiration_period_in_days: Required. The key expiration period in days. + :paramtype key_expiration_period_in_days: int + """ super(KeyPolicy, self).__init__(**kwargs) self.key_expiration_period_in_days = key_expiration_period_in_days @@ -2626,12 +3137,12 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -2660,6 +3171,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2673,18 +3192,18 @@ class LastAccessTimeTrackingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_04_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in + :vartype name: str or ~azure.mgmt.storage.v2021_04_01.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only. - :type blob_type: list[str] + :vartype blob_type: list[str] """ _validation = { @@ -2707,6 +3226,20 @@ def __init__( blob_type: Optional[List[str]] = None, **kwargs ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2021_04_01.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) self.enable = enable self.name = name @@ -2719,20 +3252,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2757,6 +3290,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2768,11 +3317,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2787,6 +3336,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2797,20 +3353,20 @@ class LeaseShareRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseShareAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseShareAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2835,6 +3391,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseShareAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseShareRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2846,11 +3418,11 @@ def __init__( class LeaseShareResponse(msrest.serialization.Model): """Lease Share response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the share, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2865,6 +3437,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the share, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseShareResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2882,9 +3461,9 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] + :vartype tags: list[str] """ _validation = { @@ -2903,6 +3482,11 @@ def __init__( tags: List[str], **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2918,8 +3502,8 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_04_01.models.TagProperty] + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2021_04_01.models.TagProperty] """ _validation = { @@ -2937,6 +3521,10 @@ def __init__( tags: Optional[List["TagProperty"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2021_04_01.models.TagProperty] + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -2963,6 +3551,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2988,6 +3578,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -3015,15 +3607,15 @@ class ListContainerItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -3035,8 +3627,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicyProperties @@ -3051,10 +3643,10 @@ class ListContainerItem(AzureEntityResource): if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container. :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the + :ivar immutable_storage_with_versioning: The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_04_01.models.ImmutableStorageWithVersioning """ @@ -3111,6 +3703,24 @@ def __init__( immutable_storage_with_versioning: Optional["ImmutableStorageWithVersioning"] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_04_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + :keyword immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_04_01.models.ImmutableStorageWithVersioning + """ super(ListContainerItem, self).__init__(**kwargs) self.version = None self.deleted = None @@ -3157,6 +3767,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3175,8 +3787,8 @@ class ListQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] """ _validation = { @@ -3198,6 +3810,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = metadata @@ -3227,6 +3843,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3253,6 +3871,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -3278,6 +3898,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -3307,6 +3929,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3333,6 +3957,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -3352,9 +3978,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySchema """ _validation = { @@ -3378,6 +4004,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -3386,12 +4017,12 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyVersion + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyVersion """ _attribute_map = { @@ -3408,6 +4039,14 @@ def __init__( version: Optional["ManagementPolicyVersion"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyVersion + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -3417,18 +4056,17 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool """ _attribute_map = { @@ -3447,6 +4085,20 @@ def __init__( enable_auto_tier_to_hot_from_cool: Optional[bool] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3459,10 +4111,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyFilter """ _validation = { @@ -3481,6 +4133,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -3491,14 +4149,14 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_04_01.models.TagFilter] + :vartype blob_index_match: list[~azure.mgmt.storage.v2021_04_01.models.TagFilter] """ _validation = { @@ -3519,6 +4177,16 @@ def __init__( blob_index_match: Optional[List["TagFilter"]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2021_04_01.models.TagFilter] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -3530,15 +4198,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_04_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2021_04_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyDefinition """ _validation = { @@ -3563,6 +4231,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2021_04_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -3575,9 +4254,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyRule] """ _validation = { @@ -3594,6 +4273,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -3601,14 +4285,14 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation """ _attribute_map = { @@ -3625,6 +4309,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3634,14 +4328,14 @@ def __init__( class ManagementPolicyVersion(msrest.serialization.Model): """Management policy action for blob version. - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation """ _attribute_map = { @@ -3658,6 +4352,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2021_04_01.models.DateAfterCreation + """ super(ManagementPolicyVersion, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3667,24 +4371,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_04_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2021_04_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -3713,6 +4417,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2021_04_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3728,8 +4452,8 @@ def __init__( class Multichannel(msrest.serialization.Model): """Multichannel setting. Applies to Premium FileStorage only. - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -3742,6 +4466,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = enabled @@ -3751,20 +4479,20 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_04_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_04_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_04_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_04_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2021_04_01.models.Bypass + :ivar resource_access_rules: Sets the resource access rules. + :vartype resource_access_rules: list[~azure.mgmt.storage.v2021_04_01.models.ResourceAccessRule] + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2021_04_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2021_04_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_04_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2021_04_01.models.DefaultAction """ _validation = { @@ -3789,6 +4517,24 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2021_04_01.models.Bypass + :keyword resource_access_rules: Sets the resource access rules. + :paramtype resource_access_rules: + list[~azure.mgmt.storage.v2021_04_01.models.ResourceAccessRule] + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2021_04_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2021_04_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2021_04_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.resource_access_rules = resource_access_rules @@ -3800,8 +4546,8 @@ def __init__( class ObjectReplicationPolicies(msrest.serialization.Model): """List storage account object replication policies. - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy] + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy] """ _attribute_map = { @@ -3814,6 +4560,10 @@ def __init__( value: Optional[List["ObjectReplicationPolicy"]] = None, **kwargs ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy] + """ super(ObjectReplicationPolicies, self).__init__(**kwargs) self.value = value @@ -3835,14 +4585,14 @@ class ObjectReplicationPolicy(Resource): :vartype policy_id: str :ivar enabled_time: Indicates when the policy is enabled on the source account. :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. It should be full resource id if + :ivar source_account: Required. Source account name. It should be full resource id if + allowCrossTenantReplication set to false. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false. - :type source_account: str - :param destination_account: Required. Destination account name. It should be full resource id - if allowCrossTenantReplication set to false. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyRule] + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyRule] """ _validation = { @@ -3872,6 +4622,16 @@ def __init__( rules: Optional[List["ObjectReplicationPolicyRule"]] = None, **kwargs ): + """ + :keyword source_account: Required. Source account name. It should be full resource id if + allowCrossTenantReplication set to false. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. It should be full resource id + if allowCrossTenantReplication set to false. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: list[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyRule] + """ super(ObjectReplicationPolicy, self).__init__(**kwargs) self.policy_id = None self.enabled_time = None @@ -3883,12 +4643,12 @@ def __init__( class ObjectReplicationPolicyFilter(msrest.serialization.Model): """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str """ _attribute_map = { @@ -3903,6 +4663,14 @@ def __init__( min_creation_time: Optional[str] = None, **kwargs ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.min_creation_time = min_creation_time @@ -3913,15 +4681,15 @@ class ObjectReplicationPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyFilter + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyFilter """ _validation = { @@ -3945,6 +4713,17 @@ def __init__( filters: Optional["ObjectReplicationPolicyFilter"] = None, **kwargs ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicyFilter + """ super(ObjectReplicationPolicyRule, self).__init__(**kwargs) self.rule_id = rule_id self.source_container = source_container @@ -3955,14 +4734,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_04_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_04_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2021_04_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2021_04_01.models.ServiceSpecification """ _attribute_map = { @@ -3981,6 +4760,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2021_04_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2021_04_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3991,14 +4780,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -4017,6 +4806,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -4027,8 +4826,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.Operation] """ _attribute_map = { @@ -4041,6 +4840,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2021_04_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -4066,6 +4869,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -4083,11 +4888,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storage.v2021_04_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -4118,6 +4923,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2021_04_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -4127,8 +4940,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection] """ _attribute_map = { @@ -4141,6 +4954,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -4162,8 +4979,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -4189,6 +5006,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -4198,8 +5019,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateLinkResource] """ _attribute_map = { @@ -4212,6 +5033,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2021_04_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -4219,15 +5044,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -4244,6 +5069,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -4253,8 +5089,8 @@ def __init__( class ProtocolSettings(msrest.serialization.Model): """Protocol settings for file service. - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_04_01.models.SmbSetting + :ivar smb: Setting for SMB protocol. + :vartype smb: ~azure.mgmt.storage.v2021_04_01.models.SmbSetting """ _attribute_map = { @@ -4267,6 +5103,10 @@ def __init__( smb: Optional["SmbSetting"] = None, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_04_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = smb @@ -4284,10 +5124,10 @@ class QueueServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules """ _validation = { @@ -4309,6 +5149,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + """ super(QueueServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -4316,10 +5162,10 @@ def __init__( class ResourceAccessRule(msrest.serialization.Model): """Resource Access Rule. - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar resource_id: Resource Id. + :vartype resource_id: str """ _attribute_map = { @@ -4334,6 +5180,12 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ super(ResourceAccessRule, self).__init__(**kwargs) self.tenant_id = tenant_id self.resource_id = resource_id @@ -4346,11 +5198,11 @@ class RestorePolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than + :ivar enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - :type days: int + :vartype days: int :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. :vartype last_enabled_time: ~datetime.datetime :ivar min_restore_time: Returns the minimum date and time that the restore can be started. @@ -4378,6 +5230,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -4395,11 +5254,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_04_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2021_04_01.models.ReasonCode """ _validation = { @@ -4419,6 +5278,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2021_04_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -4428,15 +5294,15 @@ def __init__( class RoutingPreference(msrest.serialization.Model): """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_04_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + :vartype routing_choice: str or ~azure.mgmt.storage.v2021_04_01.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing storage endpoints are to be published. - :type publish_internet_endpoints: bool + :vartype publish_internet_endpoints: bool """ _attribute_map = { @@ -4453,6 +5319,17 @@ def __init__( publish_internet_endpoints: Optional[bool] = None, **kwargs ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2021_04_01.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ super(RoutingPreference, self).__init__(**kwargs) self.routing_choice = routing_choice self.publish_microsoft_endpoints = publish_microsoft_endpoints @@ -4464,11 +5341,11 @@ class SasPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. - :type sas_expiration_period: str - :param expiration_action: Required. The SAS expiration action. Can only be Log. Possible values + :ivar sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :vartype sas_expiration_period: str + :ivar expiration_action: Required. The SAS expiration action. Can only be Log. Possible values include: "Log". Default value: "Log". - :type expiration_action: str or ~azure.mgmt.storage.v2021_04_01.models.ExpirationAction + :vartype expiration_action: str or ~azure.mgmt.storage.v2021_04_01.models.ExpirationAction """ _validation = { @@ -4488,6 +5365,13 @@ def __init__( expiration_action: Union[str, "ExpirationAction"] = "Log", **kwargs ): + """ + :keyword sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :paramtype sas_expiration_period: str + :keyword expiration_action: Required. The SAS expiration action. Can only be Log. Possible + values include: "Log". Default value: "Log". + :paramtype expiration_action: str or ~azure.mgmt.storage.v2021_04_01.models.ExpirationAction + """ super(SasPolicy, self).__init__(**kwargs) self.sas_expiration_period = sas_expiration_period self.expiration_action = expiration_action @@ -4498,49 +5382,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -4592,6 +5475,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2021_04_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_04_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_04_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -4616,8 +5545,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_04_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2021_04_01.models.MetricSpecification] """ _attribute_map = { @@ -4630,6 +5560,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2021_04_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4637,10 +5572,10 @@ def __init__( class SignedIdentifier(msrest.serialization.Model): """SignedIdentifier. - :param id: An unique identifier of the stored access policy. - :type id: str - :param access_policy: Access policy. - :type access_policy: ~azure.mgmt.storage.v2021_04_01.models.AccessPolicy + :ivar id: An unique identifier of the stored access policy. + :vartype id: str + :ivar access_policy: Access policy. + :vartype access_policy: ~azure.mgmt.storage.v2021_04_01.models.AccessPolicy """ _attribute_map = { @@ -4655,6 +5590,12 @@ def __init__( access_policy: Optional["AccessPolicy"] = None, **kwargs ): + """ + :keyword id: An unique identifier of the stored access policy. + :paramtype id: str + :keyword access_policy: Access policy. + :paramtype access_policy: ~azure.mgmt.storage.v2021_04_01.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = id self.access_policy = access_policy @@ -4667,11 +5608,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_04_01.models.SkuTier @@ -4693,6 +5634,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4724,6 +5672,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4736,11 +5686,11 @@ class SkuInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_04_01.models.SkuTier @@ -4755,9 +5705,9 @@ class SkuInformation(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2021_04_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_04_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2021_04_01.models.Restriction] """ _validation = { @@ -4786,6 +5736,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_04_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2021_04_01.models.Restriction] + """ super(SkuInformation, self).__init__(**kwargs) self.name = name self.tier = None @@ -4799,20 +5759,20 @@ def __init__( class SmbSetting(msrest.serialization.Model): """Setting for SMB protocol. - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_04_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + :ivar multichannel: Multichannel setting. Applies to Premium FileStorage only. + :vartype multichannel: ~azure.mgmt.storage.v2021_04_01.models.Multichannel + :ivar versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are + :vartype versions: str + :ivar authentication_methods: SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values + :vartype authentication_methods: str + :ivar kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are + :vartype kerberos_ticket_encryption: str + :ivar channel_encryption: SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str + :vartype channel_encryption: str """ _attribute_map = { @@ -4833,6 +5793,22 @@ def __init__( channel_encryption: Optional[str] = None, **kwargs ): + """ + :keyword multichannel: Multichannel setting. Applies to Premium FileStorage only. + :paramtype multichannel: ~azure.mgmt.storage.v2021_04_01.models.Multichannel + :keyword versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + SMB3.1.1. Should be passed as a string with delimiter ';'. + :paramtype versions: str + :keyword authentication_methods: SMB authentication methods supported by server. Valid values + are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + :paramtype authentication_methods: str + :keyword kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid + values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. + :paramtype kerberos_ticket_encryption: str + :keyword channel_encryption: SMB channel encryption supported by server. Valid values are + AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + :paramtype channel_encryption: str + """ super(SmbSetting, self).__init__(**kwargs) self.multichannel = multichannel self.versions = versions @@ -4856,10 +5832,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -4884,6 +5860,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -4904,19 +5886,19 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_04_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_04_01.models.Identity + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_04_01.models.ProvisioningState @@ -4961,51 +5943,51 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_04_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState :ivar private_endpoint_connections: List of private endpoint connection associated with the specified storage account. :vartype private_endpoint_connections: list[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference + :vartype routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference :ivar blob_restore_status: Blob restore status. :vartype blob_restore_status: ~azure.mgmt.storage.v2021_04_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool + :vartype allow_cross_tenant_replication: bool """ _validation = { @@ -5098,6 +6080,49 @@ def __init__( allow_cross_tenant_replication: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_04_01.models.Identity + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -5142,8 +6167,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -5167,6 +6192,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -5176,76 +6205,76 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the + :vartype location: str + :ivar extended_location: Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_04_01.models.Identity - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_04_01.models.Identity + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool + :vartype allow_cross_tenant_replication: bool """ _validation = { @@ -5306,6 +6335,78 @@ def __init__( allow_cross_tenant_replication: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword extended_location: Optional. Set the extended location of the resource. If not set, + the storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :paramtype extended_location: ~azure.mgmt.storage.v2021_04_01.models.ExtendedLocation + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_04_01.models.Identity + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -5364,6 +6465,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -5405,6 +6508,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -5434,6 +6539,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -5464,6 +6571,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5510,6 +6619,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -5524,9 +6635,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -5543,6 +6654,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -5550,65 +6666,64 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_04_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_04_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_04_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + :vartype allow_shared_key_access: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool + :vartype allow_cross_tenant_replication: bool """ _attribute_map = { @@ -5655,6 +6770,68 @@ def __init__( allow_cross_tenant_replication: Optional[bool] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2021_04_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_04_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_04_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_04_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2021_04_01.models.Encryption + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_04_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_04_01.models.KeyPolicy + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_04_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_04_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_04_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_04_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_04_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_04_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -5689,8 +6866,8 @@ class StorageQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] :ivar approximate_message_count: Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. @@ -5718,6 +6895,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = metadata self.approximate_message_count = None @@ -5744,6 +6925,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5751,20 +6934,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_04_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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.storage.v2021_04_01.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". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_04_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.storage.v2021_04_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -5787,6 +6970,22 @@ def __init__( 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.storage.v2021_04_01.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.storage.v2021_04_01.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 @@ -5831,6 +7030,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5848,10 +7049,10 @@ class TableServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules """ _validation = { @@ -5873,6 +7074,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2021_04_01.models.CorsRules + """ super(TableServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -5882,14 +7089,14 @@ class TagFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters. - :type value: str + :vartype value: str """ _validation = { @@ -5912,6 +7119,16 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ super(TagFilter, self).__init__(**kwargs) self.name = name self.op = op @@ -5955,6 +7172,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -6007,6 +7226,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -6050,6 +7271,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -6060,8 +7283,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_04_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2021_04_01.models.Usage] """ _attribute_map = { @@ -6074,6 +7297,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2021_04_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -6103,6 +7330,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -6133,6 +7362,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6143,15 +7374,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "Provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "Provisioning", "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_04_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2021_04_01.models.State """ _validation = { @@ -6172,6 +7403,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "Provisioning", "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2021_04_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py index 1ead554d9a0e..ddc0a65da3fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -41,11 +26,11 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class BlobInventoryPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. @@ -55,7 +40,7 @@ class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En COMPLETE = "Complete" FAILED = "Failed" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -66,7 +51,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -76,7 +61,7 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -85,14 +70,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DefaultSharePermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultSharePermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Default share permission for users using Kerberos authentication if RBAC role is not assigned. """ @@ -102,7 +87,7 @@ class DefaultSharePermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) STORAGE_FILE_DATA_SMB_SHARE_ELEVATED_CONTRIBUTOR = "StorageFileDataSmbShareElevatedContributor" STORAGE_FILE_DATA_SMB_SHARE_OWNER = "StorageFileDataSmbShareOwner" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -110,7 +95,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication protocol that is used for the file share. Can only be specified when creating a share. """ @@ -118,7 +103,7 @@ class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SMB = "SMB" NFS = "NFS" -class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. """ @@ -126,33 +111,33 @@ class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class EncryptionScopeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class ExpirationAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpirationAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SAS expiration action. Can only be Log. """ LOG = "Log" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is a required field, it specifies the format for the inventory files. """ CSV = "Csv" PARQUET = "Parquet" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -164,14 +149,14 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -180,14 +165,14 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -196,20 +181,20 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class InventoryRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Inventory """ INVENTORY = "Inventory" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -217,7 +202,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. @@ -226,7 +211,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE = "Service" ACCOUNT = "Account" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -236,14 +221,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -253,7 +238,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -261,7 +246,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseShareAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseShareAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -271,7 +256,7 @@ class LeaseShareAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -281,22 +266,22 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ListContainersInclude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MigrationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property denotes the container level immutability to object level immutability migration state. """ @@ -304,7 +289,7 @@ class MigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IN_PROGRESS = "InProgress" COMPLETED = "Completed" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -313,13 +298,13 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only """ ACCESS_TIME_TRACKING = "AccessTimeTracking" -class ObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ObjectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is a required field. This field specifies the scope of the inventory created either at the blob or container level. """ @@ -327,7 +312,7 @@ class ObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" CONTAINER = "Container" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -341,7 +326,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -350,7 +335,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -358,7 +343,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -366,7 +351,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -374,7 +359,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -382,7 +367,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -392,7 +377,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The property is for NFS share only. The default is NoRootSquash. """ @@ -400,27 +385,27 @@ class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class RoutingChoice(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Routing Choice defines the kind of network routing opted by the user. """ MICROSOFT_ROUTING = "MicrosoftRouting" INTERNET_ROUTING = "InternetRouting" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Schedule(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Schedule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is a required field. This field is used to schedule an inventory formation. """ DAILY = "Daily" WEEKLY = "Weekly" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -430,7 +415,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. """ @@ -440,7 +425,7 @@ class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" PREMIUM = "Premium" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -450,7 +435,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -460,7 +445,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -474,14 +459,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -491,12 +476,12 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" NETWORK_SOURCE_DELETED = "NetworkSourceDeleted" -class StorageAccountExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO_REPLICATION_STATS = "geoReplicationStats" BLOB_RESTORE_STATUS = "blobRestoreStatus" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py index 462b148f34db..60fb849dd95c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py @@ -5,25 +5,632 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_object_level_worm_request_initial( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 + ) class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -47,16 +654,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - include=None, # type: Optional[Union[str, "_models.ListContainersInclude"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -85,42 +692,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,20 +742,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -180,33 +785,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -224,17 +819,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -262,33 +859,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,16 +889,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -336,28 +925,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -371,16 +950,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -405,26 +986,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,15 +1010,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -474,33 +1048,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,17 +1078,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -552,33 +1118,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -592,18 +1148,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -636,40 +1194,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -679,23 +1224,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -725,32 +1273,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -760,23 +1295,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the @@ -808,31 +1346,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -842,23 +1368,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -888,29 +1417,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -920,24 +1439,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -971,37 +1493,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1011,23 +1523,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1055,36 +1570,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,43 +1603,34 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + def _object_level_worm_initial( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **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', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self._object_level_worm_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_object_level_worm_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self._object_level_worm_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1147,14 +1643,15 @@ def _object_level_worm_initial( _object_level_worm_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore + + @distributed_trace def begin_object_level_worm( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold @@ -1174,15 +1671,17 @@ def begin_object_level_worm( :type container_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -1197,22 +1696,14 @@ def begin_object_level_worm( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1224,4 +1715,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_object_level_worm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py index 559fe8fd21d4..6d62e553d8f0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +222,8 @@ def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy @@ -75,34 +234,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -111,17 +260,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - properties, # type: "_models.BlobInventoryPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Sets the blob inventory policy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -133,7 +284,8 @@ def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -146,39 +298,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -187,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: """Deletes the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -208,7 +352,8 @@ def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicyName :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 @@ -219,34 +364,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -254,13 +389,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListBlobInventoryPolicy"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -271,8 +407,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -280,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -322,12 +457,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py index c321fb09b5b2..ff61f5e3047d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-04-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -71,36 +192,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +236,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +273,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +302,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +333,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +357,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py index d90b552d047f..3fba820c864e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py @@ -5,23 +5,91 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + deleted_account_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}') + path_format_arguments = { + "deletedAccountName": _SERIALIZER.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,16 +113,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedAccountListResult"]: """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -62,34 +132,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,24 +167,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace def get( self, - deleted_account_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedAccount" + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": """Get properties of specified deleted account resource. :param deleted_account_name: Name of the deleted storage account. @@ -136,33 +202,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -171,4 +227,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py index 47ba688bd930..242e624009f8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py @@ -5,23 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,15 +212,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. @@ -82,39 +249,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -127,17 +284,19 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. @@ -165,39 +324,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -206,16 +355,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": """Returns the properties for the specified encryption scope. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -240,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -276,15 +417,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionScopeListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: """Lists all the encryption scopes available under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -295,8 +438,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -304,36 +449,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,6 +493,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py index 847af5abe28c..222f9ce654ac 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-04-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,33 +191,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceItems', pipeline_response) @@ -105,16 +216,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -138,40 +251,28 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -180,15 +281,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -209,35 +312,23 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -246,4 +337,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py index 537b68343d8f..0b8c42cbce79 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py @@ -5,23 +5,349 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + 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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_lease_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, '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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +371,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -83,42 +409,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,27 +454,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -183,41 +507,30 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -230,17 +543,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -268,39 +583,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -309,18 +614,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - expand=None, # type: Optional[str] - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -350,38 +657,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -390,18 +685,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - include=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -435,38 +732,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + include=include, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -474,15 +759,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def restore( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - deleted_share, # type: "_models.DeletedShare" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: """Restore a file share within a valid retention days if share soft delete is enabled. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -509,39 +795,29 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -549,16 +825,17 @@ def restore( restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - parameters=None, # type: Optional["_models.LeaseShareRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseShareResponse" + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + parameters: Optional["_models.LeaseShareRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseShareResponse": """The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -588,52 +865,44 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseShareRequest') + _json = self._serialize.body(parameters, 'LeaseShareRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + x_ms_snapshot=x_ms_snapshot, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LeaseShareResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py index dff12b3f4a8b..e55f865dbdd3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py index e153de6c391b..369c2693e11b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ObjectReplicationPolicies"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: """List the object replication policies associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Get the object replication policy of the storage account by policy ID. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -156,34 +314,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -192,17 +340,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - properties, # type: "_models.ObjectReplicationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Create or update the object replication policy of the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -230,39 +380,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -271,16 +411,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: """Deletes the object replication policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -305,37 +447,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py index 3cbe4e47dcad..80ea1bfe9613 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2021_04_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py index e3c788413745..8d05786da1f2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,17 +337,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -224,39 +374,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -265,16 +405,18 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -297,37 +439,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py index 96c1bcd61f0e..eae21c7ca348 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +107,17 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +131,6 @@ def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py index 44906a1016c4..df4d020f4105 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): """QueueOperations operations. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -80,39 +291,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -121,17 +322,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -158,39 +361,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -199,16 +392,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": """Gets the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -233,34 +428,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -269,16 +454,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -303,34 +490,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,15 +515,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListQueueResource"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: """Gets a list of all the queues under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -372,40 +550,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -418,12 +593,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py index ba140d41bbf6..d29406d05213 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-04-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListQueueServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": """List all queue services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,33 +191,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListQueueServices', pipeline_response) @@ -105,16 +216,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.QueueServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -138,40 +251,28 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -180,15 +281,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -209,35 +312,23 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -246,4 +337,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py index ef843343efbf..f26a301d67ff 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py index 78e7c7f39bb0..951c35f2b4df 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py @@ -5,25 +5,561 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +583,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_04_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.CheckNameAvailabilityResult @@ -69,30 +606,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +633,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +680,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +708,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_04_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +732,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +758,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +787,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +810,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -332,29 +844,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +869,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -406,32 +909,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,19 +938,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -465,34 +962,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +1002,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -528,8 +1021,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_04_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -537,35 +1032,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -583,19 +1074,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -606,7 +1098,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -618,29 +1111,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,16 +1136,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -675,7 +1159,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_04_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountListKeysResult @@ -686,32 +1171,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,16 +1200,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -756,32 +1233,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,16 +1262,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -826,32 +1295,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,39 +1324,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2021-04-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,13 +1362,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -930,15 +1383,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -952,21 +1407,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -978,47 +1426,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore def _restore_blob_ranges_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobRestoreStatus" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,16 +1474,18 @@ def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace def begin_restore_blob_ranges( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BlobRestoreStatus"] + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: """Restore blobs in the specified blob ranges. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1059,15 +1499,19 @@ def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_04_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) + :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 BlobRestoreStatus or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_04_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1079,27 +1523,21 @@ def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1111,15 +1549,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1139,25 +1578,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1169,3 +1600,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py index 60a76598f687..ea7e70fe75c6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): """TableOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -76,34 +261,24 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -112,16 +287,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -145,34 +322,24 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -181,16 +348,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Gets the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -214,34 +383,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -250,16 +409,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -283,34 +444,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -318,13 +469,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListTableResource"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: """Gets a list of all the tables under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -344,36 +496,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -386,12 +535,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py index fb13e93a213f..0bd90dc88417 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-04-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): """TableServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListTableServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": """List all table services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,33 +191,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListTableServices', pipeline_response) @@ -105,16 +216,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.TableServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": """Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -138,40 +251,28 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -180,15 +281,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": """Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -209,35 +312,23 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -246,4 +337,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py index dead9f7bf187..938d350529b5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py index a50d1e1c39a7..1072dc103161 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['StorageManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py index 8c02e8f6f624..e1898f1fc387 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class StorageManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json index 5c2931eb4a70..8db940af1b69 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "StorageManagementClient", "filename": "_storage_management_client", "description": "The Azure Storage Management API.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py index 94287daed865..d613708a52c9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py @@ -6,42 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from . import models - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -55,17 +35,23 @@ class StorageManagementClient(object): :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_06_01.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_06_01.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_06_01.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_06_01.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_06_01.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_06_01.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_06_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_06_01.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_06_01.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_06_01.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_06_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_06_01.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_06_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_06_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations @@ -86,84 +72,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py index 232662316d4d..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "19.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py index 9cfe0ace1ba9..3b85e3279ea7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._storage_management_client import StorageManagementClient __all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py index 480fd3067ddf..631e67ed515d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(StorageManagementClientConfiguration, 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.") - super(StorageManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py index 367b5f44657b..8912b515f2c8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py @@ -6,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import StorageManagementClientConfiguration -from .operations import Operations -from .operations import SkusOperations -from .operations import StorageAccountsOperations -from .operations import DeletedAccountsOperations -from .operations import UsagesOperations -from .operations import ManagementPoliciesOperations -from .operations import BlobInventoryPoliciesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ObjectReplicationPoliciesOperations -from .operations import EncryptionScopesOperations -from .operations import BlobServicesOperations -from .operations import BlobContainersOperations -from .operations import FileServicesOperations -from .operations import FileSharesOperations -from .operations import QueueServicesOperations -from .operations import QueueOperations -from .operations import TableServicesOperations -from .operations import TableOperations -from .. import models - - -class StorageManagementClient(object): +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -47,27 +29,36 @@ class StorageManagementClient(object): :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.storage.v2021_06_01.aio.operations.SkusOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.storage.v2021_06_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.storage.v2021_06_01.aio.operations.StorageAccountsOperations :ivar deleted_accounts: DeletedAccountsOperations operations - :vartype deleted_accounts: azure.mgmt.storage.v2021_06_01.aio.operations.DeletedAccountsOperations + :vartype deleted_accounts: + azure.mgmt.storage.v2021_06_01.aio.operations.DeletedAccountsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.storage.v2021_06_01.aio.operations.UsagesOperations :ivar management_policies: ManagementPoliciesOperations operations - :vartype management_policies: azure.mgmt.storage.v2021_06_01.aio.operations.ManagementPoliciesOperations + :vartype management_policies: + azure.mgmt.storage.v2021_06_01.aio.operations.ManagementPoliciesOperations :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations - :vartype blob_inventory_policies: azure.mgmt.storage.v2021_06_01.aio.operations.BlobInventoryPoliciesOperations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_06_01.aio.operations.BlobInventoryPoliciesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.storage.v2021_06_01.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_06_01.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.storage.v2021_06_01.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.storage.v2021_06_01.aio.operations.PrivateLinkResourcesOperations :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations - :vartype object_replication_policies: azure.mgmt.storage.v2021_06_01.aio.operations.ObjectReplicationPoliciesOperations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_06_01.aio.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopesOperations operations - :vartype encryption_scopes: azure.mgmt.storage.v2021_06_01.aio.operations.EncryptionScopesOperations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_06_01.aio.operations.EncryptionScopesOperations :ivar blob_services: BlobServicesOperations operations :vartype blob_services: azure.mgmt.storage.v2021_06_01.aio.operations.BlobServicesOperations :ivar blob_containers: BlobContainersOperations operations - :vartype blob_containers: azure.mgmt.storage.v2021_06_01.aio.operations.BlobContainersOperations + :vartype blob_containers: + azure.mgmt.storage.v2021_06_01.aio.operations.BlobContainersOperations :ivar file_services: FileServicesOperations operations :vartype file_services: azure.mgmt.storage.v2021_06_01.aio.operations.FileServicesOperations :ivar file_shares: FileSharesOperations operations @@ -84,82 +75,72 @@ class StorageManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = StorageManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = StorageManagementClientConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_accounts = DeletedAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.management_policies = ManagementPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_inventory_policies = BlobInventoryPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.object_replication_policies = ObjectReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.encryption_scopes = EncryptionScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_services = BlobServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob_containers = BlobContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_services = FileServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_shares = FileSharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue_services = QueueServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table_services = TableServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.table = TableOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py index 172f9af84cdb..cfc6a8b47ba0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_object_level_worm_request_initial, build_set_legal_hold_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -72,7 +78,8 @@ def list( :type include: str or ~azure.mgmt.storage.v2021_06_01.models.ListContainersInclude :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListContainerItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListContainerItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListContainerItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] @@ -80,42 +87,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +137,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -174,33 +180,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -218,8 +214,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -255,33 +254,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -295,8 +284,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -328,28 +320,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -363,8 +345,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -396,26 +381,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,6 +405,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def set_legal_hold( self, resource_group_name: str, @@ -464,33 +443,23 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -504,8 +473,11 @@ async def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace_async async def clear_legal_hold( self, resource_group_name: str, @@ -541,33 +513,23 @@ async def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -581,8 +543,11 @@ async def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace_async async def create_or_update_immutability_policy( self, resource_group_name: str, @@ -624,40 +589,27 @@ async def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -667,14 +619,18 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def get_immutability_policy( self, resource_group_name: str, @@ -712,32 +668,19 @@ async def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -747,14 +690,18 @@ async def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def delete_immutability_policy( self, resource_group_name: str, @@ -794,31 +741,19 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -828,14 +763,18 @@ async def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace_async async def lock_immutability_policy( self, resource_group_name: str, @@ -873,29 +812,19 @@ async def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -905,14 +834,18 @@ async def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace_async async def extend_immutability_policy( self, resource_group_name: str, @@ -955,37 +888,27 @@ async def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -995,14 +918,18 @@ async def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -1038,36 +965,26 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1081,8 +998,10 @@ async def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + async def _object_level_worm_initial( self, resource_group_name: str, @@ -1095,28 +1014,18 @@ async def _object_level_worm_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._object_level_worm_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_object_level_worm_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self._object_level_worm_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1129,6 +1038,8 @@ async def _object_level_worm_initial( _object_level_worm_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore + + @distributed_trace_async async def begin_object_level_worm( self, resource_group_name: str, @@ -1155,15 +1066,17 @@ async def begin_object_level_worm( :type container_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -1178,22 +1091,14 @@ async def begin_object_level_worm( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1205,4 +1110,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_object_level_worm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py index b7a5ce46e6fc..9ff36f3f94ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -106,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -127,7 +127,8 @@ async def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,39 +141,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -181,8 +172,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,7 +195,8 @@ async def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName :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 @@ -212,34 +207,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -247,6 +232,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -263,8 +250,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -272,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -314,12 +300,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py index f0fbc55dbce3..16d106740df1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BlobServiceItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.BlobServiceItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.BlobServiceItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -148,34 +154,22 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +183,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -217,29 +214,17 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +238,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py index 49f4da0cb024..b954fac898f7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._deleted_accounts_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,17 +100,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace_async async def get( self, deleted_account_name: str, @@ -130,33 +135,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -165,4 +160,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py index 52d2223b17f0..aa099fa4ed89 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def put( self, resource_group_name: str, @@ -77,39 +83,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -122,8 +118,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -159,39 +158,29 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -200,8 +189,11 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,34 +225,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -269,8 +251,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -287,8 +272,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -296,36 +283,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -343,6 +327,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py index ddd8fb80b703..8d1f1a0d7b4f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceItems', pipeline_response) @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -132,40 +130,28 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'FileServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -174,8 +160,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -202,35 +191,23 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -239,4 +216,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py index ac5907431bc4..025fb3ca1bfb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_lease_request, build_list_request, build_restore_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,7 +76,8 @@ def list( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileShareItems or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.FileShareItems] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.FileShareItems] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] @@ -78,42 +85,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,17 +130,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -177,41 +183,30 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -224,8 +219,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -261,39 +259,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -302,8 +290,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -342,38 +333,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -382,8 +361,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -426,38 +408,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + include=include, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -465,6 +435,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace_async async def restore( self, resource_group_name: str, @@ -499,39 +471,29 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -539,6 +501,8 @@ async def restore( restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + + @distributed_trace_async async def lease( self, resource_group_name: str, @@ -577,52 +541,44 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseShareRequest') + _json = self._serialize.body(parameters, 'LeaseShareRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + x_ms_snapshot=x_ms_snapshot, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LeaseShareResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py index 03fd46c48440..d5a24b15f07c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -125,7 +124,8 @@ async def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,33 +138,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -198,7 +191,8 @@ async def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName :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 @@ -209,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,3 +226,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py index 506bafc80e94..df23468afd4c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -150,34 +157,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -186,8 +183,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -223,39 +223,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -264,8 +254,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -297,37 +290,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py index 133a07c0c985..1b26e3486aac 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py index ee226514b995..3716af82c8e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -217,39 +217,29 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -258,8 +248,11 @@ async def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -289,37 +282,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py index b6f32442c750..97bca9a0194e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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_list_by_storage_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_storage_account( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,4 +94,6 @@ async def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py index 11c52db9f103..52d4d2f5f398 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -75,39 +81,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -116,8 +112,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -152,39 +151,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -193,8 +182,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -226,34 +218,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -262,8 +244,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -295,34 +280,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -330,6 +305,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -355,7 +332,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListQueueResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListQueueResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListQueueResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] @@ -363,40 +341,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -409,12 +384,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py index 5a8fd0891c6e..f804cdbadbfb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListQueueServices', pipeline_response) @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -132,40 +130,28 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueueServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -174,8 +160,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -202,35 +191,23 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -239,4 +216,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py index 450186f16430..4a9347058826 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py index 326fdd9c4230..79b6bac23f8e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # 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, HttpRequest +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._storage_accounts_operations import build_abort_hierarchical_namespace_migration_request_initial, build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_hierarchical_namespace_migration_request_initial, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", @@ -53,7 +59,8 @@ async def check_name_availability( :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_06_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.CheckNameAvailabilityResult @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -115,32 +114,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,8 +145,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -181,15 +173,20 @@ async def begin_create( :type parameters: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_06_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_06_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -201,27 +198,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -233,8 +224,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -260,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -291,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def get_properties( self, resource_group_name: str, @@ -323,29 +310,18 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,8 +335,11 @@ async def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -396,32 +375,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,8 +404,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -445,8 +417,10 @@ def list( returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -454,34 +428,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +468,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -516,8 +487,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -525,35 +498,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -571,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -593,7 +564,8 @@ async def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -605,29 +577,18 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,8 +602,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -661,7 +625,8 @@ async def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_06_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountListKeysResult @@ -672,32 +637,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +666,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def list_account_sas( self, resource_group_name: str, @@ -741,32 +699,22 @@ async def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,8 +728,11 @@ async def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace_async async def list_service_sas( self, resource_group_name: str, @@ -810,32 +761,22 @@ async def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -849,8 +790,10 @@ async def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + async def _failover_initial( self, resource_group_name: str, @@ -862,25 +805,17 @@ async def _failover_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -893,6 +828,8 @@ async def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace_async async def begin_failover( self, resource_group_name: str, @@ -912,15 +849,17 @@ async def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -934,21 +873,14 @@ async def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -960,6 +892,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore async def _hierarchical_namespace_migration_initial( @@ -974,41 +907,32 @@ async def _hierarchical_namespace_migration_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._hierarchical_namespace_migration_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['requestType'] = self._serialize.query("request_type", request_type, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + request_type=request_type, + template_url=self._hierarchical_namespace_migration_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore + + @distributed_trace_async async def begin_hierarchical_namespace_migration( self, resource_group_name: str, @@ -1032,15 +956,17 @@ async def begin_hierarchical_namespace_migration( :type request_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 this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -1055,21 +981,14 @@ async def begin_hierarchical_namespace_migration( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1081,6 +1000,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore async def _abort_hierarchical_namespace_migration_initial( @@ -1094,40 +1014,31 @@ async def _abort_hierarchical_namespace_migration_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._abort_hierarchical_namespace_migration_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_abort_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._abort_hierarchical_namespace_migration_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _abort_hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore + + @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( self, resource_group_name: str, @@ -1145,15 +1056,17 @@ async def begin_abort_hierarchical_namespace_migration( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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', @@ -1167,21 +1080,14 @@ async def begin_abort_hierarchical_namespace_migration( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1193,6 +1099,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_abort_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore async def _restore_blob_ranges_initial( @@ -1207,32 +1114,22 @@ async def _restore_blob_ranges_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1250,8 +1147,11 @@ async def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async async def begin_restore_blob_ranges( self, resource_group_name: str, @@ -1272,15 +1172,20 @@ async def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_06_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreStatus] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1292,27 +1197,21 @@ async def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1324,8 +1223,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace_async async def revoke_user_delegation_keys( self, resource_group_name: str, @@ -1351,25 +1252,17 @@ async def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1381,3 +1274,4 @@ async def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py index 634b8f9b649d..67f077bd90d6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -71,34 +77,24 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -107,8 +103,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -139,34 +138,24 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -175,8 +164,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -207,34 +199,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -243,8 +225,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -275,34 +260,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -310,6 +285,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -327,7 +304,8 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListTableResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListTableResource] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListTableResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] @@ -335,36 +313,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -377,12 +352,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py index dbd68eb1ef0c..883e0ff08850 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListTableServices', pipeline_response) @@ -100,8 +95,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace_async async def set_service_properties( self, resource_group_name: str, @@ -132,40 +130,28 @@ async def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TableServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -174,8 +160,11 @@ async def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace_async async def get_service_properties( self, resource_group_name: str, @@ -202,35 +191,23 @@ async def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -239,4 +216,6 @@ async def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py index 6b592ccc4828..fda99797eccd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # 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, HttpRequest +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._usages_operations import build_list_by_location_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location: str, @@ -53,7 +59,8 @@ def list_by_location( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_06_01.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -61,35 +68,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +110,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py index 41c730b3261f..404e980009f7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py @@ -6,290 +6,148 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessPolicy - from ._models_py3 import AccountImmutabilityPolicyProperties - from ._models_py3 import AccountSasParameters - from ._models_py3 import ActiveDirectoryProperties - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureFilesIdentityBasedAuthentication - from ._models_py3 import BlobContainer - from ._models_py3 import BlobInventoryPolicy - from ._models_py3 import BlobInventoryPolicyDefinition - from ._models_py3 import BlobInventoryPolicyFilter - from ._models_py3 import BlobInventoryPolicyRule - from ._models_py3 import BlobInventoryPolicySchema - from ._models_py3 import BlobRestoreParameters - from ._models_py3 import BlobRestoreRange - from ._models_py3 import BlobRestoreStatus - from ._models_py3 import BlobServiceItems - from ._models_py3 import BlobServiceProperties - from ._models_py3 import ChangeFeed - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorAutoGenerated - from ._models_py3 import CloudErrorBody - from ._models_py3 import CloudErrorBodyAutoGenerated - from ._models_py3 import CorsRule - from ._models_py3 import CorsRules - from ._models_py3 import CustomDomain - from ._models_py3 import DateAfterCreation - from ._models_py3 import DateAfterModification - from ._models_py3 import DeleteRetentionPolicy - from ._models_py3 import DeletedAccount - from ._models_py3 import DeletedAccountListResult - from ._models_py3 import DeletedShare - from ._models_py3 import Dimension - from ._models_py3 import Encryption - from ._models_py3 import EncryptionIdentity - from ._models_py3 import EncryptionScope - from ._models_py3 import EncryptionScopeKeyVaultProperties - from ._models_py3 import EncryptionScopeListResult - from ._models_py3 import EncryptionService - from ._models_py3 import EncryptionServices - from ._models_py3 import Endpoints - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import ExtendedLocation - from ._models_py3 import FileServiceItems - from ._models_py3 import FileServiceProperties - from ._models_py3 import FileShare - from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems - from ._models_py3 import GeoReplicationStats - from ._models_py3 import IPRule - from ._models_py3 import Identity - from ._models_py3 import ImmutabilityPolicy - from ._models_py3 import ImmutabilityPolicyProperties - from ._models_py3 import ImmutableStorageAccount - from ._models_py3 import ImmutableStorageWithVersioning - from ._models_py3 import KeyCreationTime - from ._models_py3 import KeyPolicy - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LastAccessTimeTrackingPolicy - from ._models_py3 import LeaseContainerRequest - from ._models_py3 import LeaseContainerResponse - from ._models_py3 import LeaseShareRequest - from ._models_py3 import LeaseShareResponse - from ._models_py3 import LegalHold - from ._models_py3 import LegalHoldProperties - from ._models_py3 import ListAccountSasResponse - from ._models_py3 import ListBlobInventoryPolicy - from ._models_py3 import ListContainerItem - from ._models_py3 import ListContainerItems - from ._models_py3 import ListQueue - from ._models_py3 import ListQueueResource - from ._models_py3 import ListQueueServices - from ._models_py3 import ListServiceSasResponse - from ._models_py3 import ListTableResource - from ._models_py3 import ListTableServices - from ._models_py3 import ManagementPolicy - from ._models_py3 import ManagementPolicyAction - from ._models_py3 import ManagementPolicyBaseBlob - from ._models_py3 import ManagementPolicyDefinition - from ._models_py3 import ManagementPolicyFilter - from ._models_py3 import ManagementPolicyRule - from ._models_py3 import ManagementPolicySchema - from ._models_py3 import ManagementPolicySnapShot - from ._models_py3 import ManagementPolicyVersion - from ._models_py3 import MetricSpecification - from ._models_py3 import Multichannel - from ._models_py3 import NetworkRuleSet - from ._models_py3 import ObjectReplicationPolicies - from ._models_py3 import ObjectReplicationPolicy - from ._models_py3 import ObjectReplicationPolicyFilter - from ._models_py3 import ObjectReplicationPolicyRule - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProtectedAppendWritesHistory - from ._models_py3 import ProtocolSettings - from ._models_py3 import ProxyResource - from ._models_py3 import QueueServiceProperties - from ._models_py3 import Resource - from ._models_py3 import ResourceAccessRule - from ._models_py3 import RestorePolicyProperties - from ._models_py3 import Restriction - from ._models_py3 import RoutingPreference - from ._models_py3 import SKUCapability - from ._models_py3 import SasPolicy - from ._models_py3 import ServiceSasParameters - from ._models_py3 import ServiceSpecification - from ._models_py3 import SignedIdentifier - from ._models_py3 import Sku - from ._models_py3 import SkuInformation - from ._models_py3 import SmbSetting - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCheckNameAvailabilityParameters - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountInternetEndpoints - from ._models_py3 import StorageAccountKey - from ._models_py3 import StorageAccountListKeysResult - from ._models_py3 import StorageAccountListResult - from ._models_py3 import StorageAccountMicrosoftEndpoints - from ._models_py3 import StorageAccountRegenerateKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageQueue - from ._models_py3 import StorageSkuListResult - from ._models_py3 import SystemData - from ._models_py3 import Table - from ._models_py3 import TableServiceProperties - from ._models_py3 import TagFilter - from ._models_py3 import TagProperty - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateHistoryProperty - from ._models_py3 import Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import UserAssignedIdentity - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccessPolicy # type: ignore - from ._models import AccountImmutabilityPolicyProperties # type: ignore - from ._models import AccountSasParameters # type: ignore - from ._models import ActiveDirectoryProperties # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureFilesIdentityBasedAuthentication # type: ignore - from ._models import BlobContainer # type: ignore - from ._models import BlobInventoryPolicy # type: ignore - from ._models import BlobInventoryPolicyDefinition # type: ignore - from ._models import BlobInventoryPolicyFilter # type: ignore - from ._models import BlobInventoryPolicyRule # type: ignore - from ._models import BlobInventoryPolicySchema # type: ignore - from ._models import BlobRestoreParameters # type: ignore - from ._models import BlobRestoreRange # type: ignore - from ._models import BlobRestoreStatus # type: ignore - from ._models import BlobServiceItems # type: ignore - from ._models import BlobServiceProperties # type: ignore - from ._models import ChangeFeed # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorAutoGenerated # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CloudErrorBodyAutoGenerated # type: ignore - from ._models import CorsRule # type: ignore - from ._models import CorsRules # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import DateAfterCreation # type: ignore - from ._models import DateAfterModification # type: ignore - from ._models import DeleteRetentionPolicy # type: ignore - from ._models import DeletedAccount # type: ignore - from ._models import DeletedAccountListResult # type: ignore - from ._models import DeletedShare # type: ignore - from ._models import Dimension # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionIdentity # type: ignore - from ._models import EncryptionScope # type: ignore - from ._models import EncryptionScopeKeyVaultProperties # type: ignore - from ._models import EncryptionScopeListResult # type: ignore - from ._models import EncryptionService # type: ignore - from ._models import EncryptionServices # type: ignore - from ._models import Endpoints # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import FileServiceItems # type: ignore - from ._models import FileServiceProperties # type: ignore - from ._models import FileShare # type: ignore - from ._models import FileShareItem # type: ignore - from ._models import FileShareItems # type: ignore - from ._models import GeoReplicationStats # type: ignore - from ._models import IPRule # type: ignore - from ._models import Identity # type: ignore - from ._models import ImmutabilityPolicy # type: ignore - from ._models import ImmutabilityPolicyProperties # type: ignore - from ._models import ImmutableStorageAccount # type: ignore - from ._models import ImmutableStorageWithVersioning # type: ignore - from ._models import KeyCreationTime # type: ignore - from ._models import KeyPolicy # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LastAccessTimeTrackingPolicy # type: ignore - from ._models import LeaseContainerRequest # type: ignore - from ._models import LeaseContainerResponse # type: ignore - from ._models import LeaseShareRequest # type: ignore - from ._models import LeaseShareResponse # type: ignore - from ._models import LegalHold # type: ignore - from ._models import LegalHoldProperties # type: ignore - from ._models import ListAccountSasResponse # type: ignore - from ._models import ListBlobInventoryPolicy # type: ignore - from ._models import ListContainerItem # type: ignore - from ._models import ListContainerItems # type: ignore - from ._models import ListQueue # type: ignore - from ._models import ListQueueResource # type: ignore - from ._models import ListQueueServices # type: ignore - from ._models import ListServiceSasResponse # type: ignore - from ._models import ListTableResource # type: ignore - from ._models import ListTableServices # type: ignore - from ._models import ManagementPolicy # type: ignore - from ._models import ManagementPolicyAction # type: ignore - from ._models import ManagementPolicyBaseBlob # type: ignore - from ._models import ManagementPolicyDefinition # type: ignore - from ._models import ManagementPolicyFilter # type: ignore - from ._models import ManagementPolicyRule # type: ignore - from ._models import ManagementPolicySchema # type: ignore - from ._models import ManagementPolicySnapShot # type: ignore - from ._models import ManagementPolicyVersion # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import Multichannel # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import ObjectReplicationPolicies # type: ignore - from ._models import ObjectReplicationPolicy # type: ignore - from ._models import ObjectReplicationPolicyFilter # type: ignore - from ._models import ObjectReplicationPolicyRule # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProtectedAppendWritesHistory # type: ignore - from ._models import ProtocolSettings # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueueServiceProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceAccessRule # type: ignore - from ._models import RestorePolicyProperties # type: ignore - from ._models import Restriction # type: ignore - from ._models import RoutingPreference # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import SasPolicy # type: ignore - from ._models import ServiceSasParameters # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import SignedIdentifier # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SmbSetting # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCheckNameAvailabilityParameters # type: ignore - from ._models import StorageAccountCreateParameters # type: ignore - from ._models import StorageAccountInternetEndpoints # type: ignore - from ._models import StorageAccountKey # type: ignore - from ._models import StorageAccountListKeysResult # type: ignore - from ._models import StorageAccountListResult # type: ignore - from ._models import StorageAccountMicrosoftEndpoints # type: ignore - from ._models import StorageAccountRegenerateKeyParameters # type: ignore - from ._models import StorageAccountUpdateParameters # type: ignore - from ._models import StorageQueue # type: ignore - from ._models import StorageSkuListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import Table # type: ignore - from ._models import TableServiceProperties # type: ignore - from ._models import TagFilter # type: ignore - from ._models import TagProperty # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateHistoryProperty # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import UserAssignedIdentity # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccessPolicy +from ._models_py3 import AccountImmutabilityPolicyProperties +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorAutoGenerated +from ._models_py3 import CloudErrorBody +from ._models_py3 import CloudErrorBodyAutoGenerated +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedAccount +from ._models_py3 import DeletedAccountListResult +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionIdentity +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import ImmutableStorageAccount +from ._models_py3 import ImmutableStorageWithVersioning +from ._models_py3 import KeyCreationTime +from ._models_py3 import KeyPolicy +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LeaseShareRequest +from ._models_py3 import LeaseShareResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import Multichannel +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProtectedAppendWritesHistory +from ._models_py3 import ProtocolSettings +from ._models_py3 import ProxyResource +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceAccessRule +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import SasPolicy +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import SignedIdentifier +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import SmbSetting +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VirtualNetworkRule + from ._storage_management_client_enums import ( AccessTier, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models.py deleted file mode 100644 index df1e7ef924c7..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models.py +++ /dev/null @@ -1,5943 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccessPolicy(msrest.serialization.Model): - """AccessPolicy. - - :param start_time: Start time of the access policy. - :type start_time: ~datetime.datetime - :param expiry_time: Expiry time of the access policy. - :type expiry_time: ~datetime.datetime - :param permission: List of abbreviated permissions. - :type permission: str - """ - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'permission': {'key': 'permission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessPolicy, self).__init__(**kwargs) - self.start_time = kwargs.get('start_time', None) - self.expiry_time = kwargs.get('expiry_time', None) - self.permission = kwargs.get('permission', None) - - -class AccountImmutabilityPolicyProperties(msrest.serialization.Model): - """This defines account-level immutability policy properties. - - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :param state: The ImmutabilityPolicy state defines the mode of the policy. Disabled state - disables the policy, Unlocked state allows increase and decrease of immutability retention time - and also allows toggling allowProtectedAppendWrites property, Locked state only allows the - increase of the immutability retention time. A policy can only be created in a Disabled or - Unlocked state and can be toggled between the two states. Only a policy in an Unlocked state - can transition to a Locked state which cannot be reverted. Possible values include: "Unlocked", - "Locked", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for disabled and - unlocked time-based retention policies. When enabled, new blocks can be written to an append - blob while maintaining immutability protection and compliance. Only new blocks can be added and - any existing blocks cannot be modified or deleted. - :type allow_protected_append_writes: bool - """ - - _validation = { - 'immutability_period_since_creation_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'allowProtectedAppendWrites', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountImmutabilityPolicyProperties, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = kwargs.get('state', None) - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - - -class AccountSasParameters(msrest.serialization.Model): - """The parameters to list SAS credentials of a storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: Required. The signed services accessible with the account SAS. Possible values - include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_06_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account - SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; - Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. - Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values - include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process - (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature - becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - """ - - _validation = { - 'services': {'required': True}, - 'resource_types': {'required': True}, - 'permissions': {'required': True}, - 'shared_access_expiry_time': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'signedServices', 'type': 'str'}, - 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSasParameters, self).__init__(**kwargs) - self.services = kwargs['services'] - self.resource_types = kwargs['resource_types'] - self.permissions = kwargs['permissions'] - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs['shared_access_expiry_time'] - self.key_to_sign = kwargs.get('key_to_sign', None) - - -class ActiveDirectoryProperties(msrest.serialization.Model): - """Settings properties for Active Directory (AD). - - All required parameters must be populated in order to send to Azure. - - :param domain_name: Required. Specifies the primary domain that the AD DNS server is - authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str - """ - - _validation = { - 'domain_name': {'required': True}, - 'net_bios_domain_name': {'required': True}, - 'forest_name': {'required': True}, - 'domain_guid': {'required': True}, - 'domain_sid': {'required': True}, - 'azure_storage_sid': {'required': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, - 'forest_name': {'key': 'forestName', 'type': 'str'}, - 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, - 'domain_sid': {'key': 'domainSid', 'type': 'str'}, - 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryProperties, self).__init__(**kwargs) - self.domain_name = kwargs['domain_name'] - self.net_bios_domain_name = kwargs['net_bios_domain_name'] - self.forest_name = kwargs['forest_name'] - self.domain_guid = kwargs['domain_guid'] - self.domain_sid = kwargs['domain_sid'] - self.azure_storage_sid = kwargs['azure_storage_sid'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): - """Settings for Azure Files identity based authentication. - - All required parameters must be populated in order to send to Azure. - - :param directory_service_options: Required. Indicates the directory service used. Possible - values include: "None", "AADDS", "AD". - :type directory_service_options: str or - ~azure.mgmt.storage.v2021_06_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: - ~azure.mgmt.storage.v2021_06_01.models.ActiveDirectoryProperties - :param default_share_permission: Default share permission for users using Kerberos - authentication if RBAC role is not assigned. Possible values include: "None", - "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", - "StorageFileDataSmbShareElevatedContributor". - :type default_share_permission: str or - ~azure.mgmt.storage.v2021_06_01.models.DefaultSharePermission - """ - - _validation = { - 'directory_service_options': {'required': True}, - } - - _attribute_map = { - 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, - 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, - 'default_share_permission': {'key': 'defaultSharePermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) - self.directory_service_options = kwargs['directory_service_options'] - self.active_directory_properties = kwargs.get('active_directory_properties', None) - self.default_share_permission = kwargs.get('default_share_permission', None) - - -class BlobContainer(AzureEntityResource): - """Properties of the blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_06_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the - container. The property is immutable and can only be set to true at the container creation - time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageWithVersioning - :param enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. - :type enable_nfs_v3_root_squash: bool - :param enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. - :type enable_nfs_v3_all_squash: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageWithVersioning'}, - 'enable_nfs_v3_root_squash': {'key': 'properties.enableNfsV3RootSquash', 'type': 'bool'}, - 'enable_nfs_v3_all_squash': {'key': 'properties.enableNfsV3AllSquash', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobContainer, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - self.enable_nfs_v3_root_squash = kwargs.get('enable_nfs_v3_root_squash', None) - self.enable_nfs_v3_all_squash = kwargs.get('enable_nfs_v3_all_squash', None) - - -class BlobInventoryPolicy(Resource): - """The storage account blob inventory policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.storage.v2021_06_01.models.SystemData - :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. - :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicy, self).__init__(**kwargs) - self.system_data = None - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class BlobInventoryPolicyDefinition(msrest.serialization.Model): - """An object that defines the blob inventory rule. - - All required parameters must be populated in order to send to Azure. - - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyFilter - :param format: Required. This is a required field, it specifies the format for the inventory - files. Possible values include: "Csv", "Parquet". - :type format: str or ~azure.mgmt.storage.v2021_06_01.models.Format - :param schedule: Required. This is a required field. This field is used to schedule an - inventory formation. Possible values include: "Daily", "Weekly". - :type schedule: str or ~azure.mgmt.storage.v2021_06_01.models.Schedule - :param object_type: Required. This is a required field. This field specifies the scope of the - inventory created either at the blob or container level. Possible values include: "Blob", - "Container". - :type object_type: str or ~azure.mgmt.storage.v2021_06_01.models.ObjectType - :param schema_fields: Required. This is a required field. This field specifies the fields and - properties of the object to be included in the inventory. The Schema field value 'Name' is - always required. The valid values for this field for the 'Blob' definition.objectType include - 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, - AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, hdi_isfolder, Owner, Group, - Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid - values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, - LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. - Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only - for Hns enabled accounts.'Tags' field is only valid for non Hns accounts. - :type schema_fields: list[str] - """ - - _validation = { - 'format': {'required': True}, - 'schedule': {'required': True}, - 'object_type': {'required': True}, - 'schema_fields': {'required': True}, - } - - _attribute_map = { - 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, - 'format': {'key': 'format', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'schema_fields': {'key': 'schemaFields', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) - self.filters = kwargs.get('filters', None) - self.format = kwargs['format'] - self.schedule = kwargs['schedule'] - self.object_type = kwargs['object_type'] - self.schema_fields = kwargs['schema_fields'] - - -class BlobInventoryPolicyFilter(msrest.serialization.Model): - """An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. - - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: An array of predefined enum values. Valid values include blockBlob, - appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when - definition.objectType property is set to 'Blob'. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value is set to - true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this - property is set to true, else they must be excluded. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value is set to true. - The definition.schemaFields value 'Snapshot' is required if this property is set to true, else - it must be excluded. - :type include_snapshots: bool - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, - 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs.get('blob_types', None) - self.include_blob_versions = kwargs.get('include_blob_versions', None) - self.include_snapshots = kwargs.get('include_snapshots', None) - - -class BlobInventoryPolicyRule(msrest.serialization.Model): - """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param destination: Required. Container name where blob inventory files are stored. Must be - pre-created. - :type destination: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyDefinition - """ - - _validation = { - 'enabled': {'required': True}, - 'name': {'required': True}, - 'destination': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.name = kwargs['name'] - self.destination = kwargs['destination'] - self.definition = kwargs['definition'] - - -class BlobInventoryPolicySchema(msrest.serialization.Model): - """The storage account blob inventory policy rules. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied - when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyRule] - """ - - _validation = { - 'enabled': {'required': True}, - 'type': {'required': True}, - 'rules': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobInventoryPolicySchema, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.type = kwargs['type'] - self.rules = kwargs['rules'] - - -class BlobRestoreParameters(msrest.serialization.Model): - """Blob restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreRange] - """ - - _validation = { - 'time_to_restore': {'required': True}, - 'blob_ranges': {'required': True}, - } - - _attribute_map = { - 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, - 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreParameters, self).__init__(**kwargs) - self.time_to_restore = kwargs['time_to_restore'] - self.blob_ranges = kwargs['blob_ranges'] - - -class BlobRestoreRange(msrest.serialization.Model): - """Blob range. - - All required parameters must be populated in order to send to Azure. - - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str - """ - - _validation = { - 'start_range': {'required': True}, - 'end_range': {'required': True}, - } - - _attribute_map = { - 'start_range': {'key': 'startRange', 'type': 'str'}, - 'end_range': {'key': 'endRange', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreRange, self).__init__(**kwargs) - self.start_range = kwargs['start_range'] - self.end_range = kwargs['end_range'] - - -class BlobRestoreStatus(msrest.serialization.Model): - """Blob restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates - that blob restore is ongoing. - Complete: Indicates that blob restore has been completed - successfully. - Failed: Indicates that blob restore is failed. Possible values include: - "InProgress", "Complete", "Failed". - :vartype status: str or ~azure.mgmt.storage.v2021_06_01.models.BlobRestoreProgressStatus - :ivar failure_reason: Failure reason when blob restore is failed. - :vartype failure_reason: str - :ivar restore_id: Id for tracking blob restore request. - :vartype restore_id: str - :ivar parameters: Blob restore request parameters. - :vartype parameters: ~azure.mgmt.storage.v2021_06_01.models.BlobRestoreParameters - """ - - _validation = { - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'restore_id': {'readonly': True}, - 'parameters': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - 'restore_id': {'key': 'restoreId', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobRestoreStatus, self).__init__(**kwargs) - self.status = None - self.failure_reason = None - self.restore_id = None - self.parameters = None - - -class BlobServiceItems(msrest.serialization.Model): - """BlobServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob services returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.BlobServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceItems, self).__init__(**kwargs) - self.value = None - - -class BlobServiceProperties(Resource): - """The properties of a storage account’s Blob service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for - requests to the Blob service if an incoming request’s version is not specified. Possible values - include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_06_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_06_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: - ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: - ~azure.mgmt.storage.v2021_06_01.models.LastAccessTimeTrackingPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, - 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, - 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, - 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, - 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, - 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(BlobServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.default_service_version = kwargs.get('default_service_version', None) - self.delete_retention_policy = kwargs.get('delete_retention_policy', None) - self.is_versioning_enabled = kwargs.get('is_versioning_enabled', None) - self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) - self.change_feed = kwargs.get('change_feed', None) - self.restore_policy = kwargs.get('restore_policy', None) - self.container_delete_retention_policy = kwargs.get('container_delete_retention_policy', None) - self.last_access_time_tracking_policy = kwargs.get('last_access_time_tracking_policy', None) - - -class ChangeFeed(msrest.serialization.Model): - """The blob service properties for change feed events. - - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value - is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite - retention of the change feed. - :type retention_in_days: int - """ - - _validation = { - 'retention_in_days': {'maximum': 146000, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ChangeFeed, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.retention_in_days = kwargs.get('retention_in_days', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a storage account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storage.v2021_06_01.models.Reason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorAutoGenerated(msrest.serialization.Model): - """An error response from the Storage service. - - :param error: An error response from the Storage service. - :type error: ~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBodyAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorAutoGenerated, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CloudErrorBodyAutoGenerated(msrest.serialization.Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBodyAutoGenerated]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBodyAutoGenerated, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CorsRule(msrest.serialization.Model): - """Specifies a CORS rule for the Blob service. - - All required parameters must be populated in order to send to Azure. - - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin - domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP - methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or - ~azure.mgmt.storage.v2021_06_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of - seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response - headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers - allowed to be part of the cross-origin request. - :type allowed_headers: list[str] - """ - - _validation = { - 'allowed_origins': {'required': True}, - 'allowed_methods': {'required': True}, - 'max_age_in_seconds': {'required': True}, - 'exposed_headers': {'required': True}, - 'allowed_headers': {'required': True}, - } - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs['allowed_origins'] - self.allowed_methods = kwargs['allowed_methods'] - self.max_age_in_seconds = kwargs['max_age_in_seconds'] - self.exposed_headers = kwargs['exposed_headers'] - self.allowed_headers = kwargs['allowed_headers'] - - -class CorsRules(msrest.serialization.Model): - """Sets the CORS rules. You can include up to five CorsRule elements in the request. - - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the - request. - :type cors_rules: list[~azure.mgmt.storage.v2021_06_01.models.CorsRule] - """ - - _attribute_map = { - 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CorsRules, self).__init__(**kwargs) - self.cors_rules = kwargs.get('cors_rules', None) - - -class CustomDomain(msrest.serialization.Model): - """The custom domain assigned to this storage account. This can be set via Update. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default - value is false. This should only be set on updates. - :type use_sub_domain_name: bool - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs['name'] - self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) - - -class DateAfterCreation(msrest.serialization.Model): - """Object to define the number of days after creation. - - All required parameters must be populated in order to send to Azure. - - :param days_after_creation_greater_than: Required. Value indicating the age in days after - creation. - :type days_after_creation_greater_than: float - """ - - _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterCreation, self).__init__(**kwargs) - self.days_after_creation_greater_than = kwargs['days_after_creation_greater_than'] - - -class DateAfterModification(msrest.serialization.Model): - """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - - :param days_after_modification_greater_than: Value indicating the age in days after last - modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last - blob access. This property can only be used in conjunction with last access time tracking - policy. - :type days_after_last_access_time_greater_than: float - """ - - _validation = { - 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, - 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, - } - - _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, - 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DateAfterModification, self).__init__(**kwargs) - self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) - self.days_after_last_access_time_greater_than = kwargs.get('days_after_last_access_time_greater_than', None) - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class DeletedAccount(ProxyResource): - """Deleted storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar storage_account_resource_id: Full resource id of the original storage account. - :vartype storage_account_resource_id: str - :ivar location: Location of the deleted account. - :vartype location: str - :ivar restore_reference: Can be used to attempt recovering this deleted account via - PutStorageAccount API. - :vartype restore_reference: str - :ivar creation_time: Creation time of the deleted account. - :vartype creation_time: str - :ivar deletion_time: Deletion time of the deleted account. - :vartype deletion_time: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'storage_account_resource_id': {'readonly': True}, - 'location': {'readonly': True}, - 'restore_reference': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'deletion_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'location': {'key': 'properties.location', 'type': 'str'}, - 'restore_reference': {'key': 'properties.restoreReference', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'deletion_time': {'key': 'properties.deletionTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccount, self).__init__(**kwargs) - self.storage_account_resource_id = None - self.location = None - self.restore_reference = None - self.creation_time = None - self.deletion_time = None - - -class DeletedAccountListResult(msrest.serialization.Model): - """The response from the List Deleted Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of deleted accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.DeletedAccount] - :ivar next_link: Request URL that can be used to query next page of deleted accounts. Returned - when total number of requested deleted accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DeletedShare(msrest.serialization.Model): - """The deleted share to be restored. - - All required parameters must be populated in order to send to Azure. - - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will - be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str - """ - - _validation = { - 'deleted_share_name': {'required': True}, - 'deleted_share_version': {'required': True}, - } - - _attribute_map = { - 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, - 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedShare, self).__init__(**kwargs) - self.deleted_share_name = kwargs['deleted_share_name'] - self.deleted_share_version = kwargs['deleted_share_version'] - - -class DeleteRetentionPolicy(msrest.serialization.Model): - """The service properties for soft delete. - - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum - specified value can be 1 and the maximum value can be 365. - :type days: int - """ - - _validation = { - 'days': {'maximum': 365, 'minimum': 1}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteRetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.days = kwargs.get('days', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class Encryption(msrest.serialization.Model): - """The encryption settings on the storage account. - - All required parameters must be populated in order to send to Azure. - - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_06_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: - "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_06_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_06_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_06_01.models.EncryptionIdentity - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'services': {'key': 'services', 'type': 'EncryptionServices'}, - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, - 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, - 'encryption_identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.services = kwargs.get('services', None) - self.key_source = kwargs.get('key_source', "Microsoft.Storage") - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.encryption_identity = kwargs.get('encryption_identity', None) - - -class EncryptionIdentity(msrest.serialization.Model): - """Encryption identity for the storage account. - - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str - """ - - _attribute_map = { - 'encryption_user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionIdentity, self).__init__(**kwargs) - self.encryption_user_assigned_identity = kwargs.get('encryption_user_assigned_identity', None) - - -class EncryptionScope(Resource): - """The Encryption Scope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): - Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", - "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, - Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeState - :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modification date and time of the encryption scope in - UTC. - :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a - required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: - ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, - 'require_infrastructure_encryption': {'key': 'properties.requireInfrastructureEncryption', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScope, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.state = kwargs.get('state', None) - self.creation_time = None - self.last_modified_time = None - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - - -class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): - """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_uri: The object identifier for a key vault key object. When applied, the encryption - scope will use the key referenced by the identifier to enable customer-managed key support on - this encryption scope. - :type key_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class EncryptionScopeListResult(msrest.serialization.Model): - """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of encryption scopes requested. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.EncryptionScope] - :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned - when total number of requested encryption scopes exceeds the maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionScopeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EncryptionService(msrest.serialization.Model): - """A service that allows server-side encryption to be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: A boolean indicating whether or not the service encrypts the data as it is - stored. - :type enabled: bool - :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last - enabled by the user. Only returned when encryption is enabled. There might be some unencrypted - blobs which were written after this time, as it is just a rough estimate. - :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type - implies that an account-scoped encryption key will be used. 'Service' key type implies that a - default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_06_01.models.KeyType - """ - - _validation = { - 'last_enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionService, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.last_enabled_time = None - self.key_type = kwargs.get('key_type', None) - - -class EncryptionServices(msrest.serialization.Model): - """A list of services that support encryption. - - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - """ - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'EncryptionService'}, - 'file': {'key': 'file', 'type': 'EncryptionService'}, - 'table': {'key': 'table', 'type': 'EncryptionService'}, - 'queue': {'key': 'queue', 'type': 'EncryptionService'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionServices, self).__init__(**kwargs) - self.blob = kwargs.get('blob', None) - self.file = kwargs.get('file', None) - self.table = kwargs.get('table', None) - self.queue = kwargs.get('queue', None) - - -class Endpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: - ~azure.mgmt.storage.v2021_06_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: - ~azure.mgmt.storage.v2021_06_01.models.StorageAccountInternetEndpoints - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, - 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - self.microsoft_endpoints = kwargs.get('microsoft_endpoints', None) - self.internet_endpoints = kwargs.get('internet_endpoints', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the storage resource provider. - - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_06_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body contract. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExtendedLocation(msrest.serialization.Model): - """The complex type of the extended location. - - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocationTypes - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class FileServiceItems(msrest.serialization.Model): - """FileServiceItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file services returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.FileServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceItems, self).__init__(**kwargs) - self.value = None - - -class FileServiceProperties(Resource): - """The properties of File services in storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar sku: Sku name and tier. - :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: - ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_06_01.models.ProtocolSettings - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'sku': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, - 'protocol_settings': {'key': 'properties.protocolSettings', 'type': 'ProtocolSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(FileServiceProperties, self).__init__(**kwargs) - self.sku = None - self.cors = kwargs.get('cors', None) - self.share_delete_retention_policy = kwargs.get('share_delete_retention_policy', None) - self.protocol_settings = kwargs.get('protocol_settings', None) - - -class FileShare(AzureEntityResource): - """Properties of the file share, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar lease_status: The lease status of the share. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseStatus - :ivar lease_state: Lease state of the share. Possible values include: "Available", "Leased", - "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, - only when the share is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'signed_identifiers': {'key': 'properties.signedIdentifiers', 'type': '[SignedIdentifier]'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShare, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.signed_identifiers = kwargs.get('signed_identifiers', None) - self.snapshot_time = None - - -class FileShareItem(AzureEntityResource): - """The file share properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar last_modified_time: Returns the date and time the share was last modified. - :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and - less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only - be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible - values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType - :ivar version: The version of the share. - :vartype version: str - :ivar deleted: Indicates whether the share was deleted. - :vartype deleted: bool - :ivar deleted_time: The deleted time if the share was deleted. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. - :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between - TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible - values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier - :ivar access_tier_change_time: Indicates the last modification time for share access tier. - :vartype access_tier_change_time: ~datetime.datetime - :ivar access_tier_status: Indicates if there is a pending transition for access tier. - :vartype access_tier_status: str - :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this - value may not include all recently created or recently resized files. - :vartype share_usage_bytes: long - :ivar lease_status: The lease status of the share. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseStatus - :ivar lease_state: Lease state of the share. Possible values include: "Available", "Leased", - "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, - only when the share is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] - :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares - with expand param "snapshots". - :vartype snapshot_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'share_quota': {'maximum': 102400, 'minimum': 1}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'access_tier_change_time': {'readonly': True}, - 'access_tier_status': {'readonly': True}, - 'share_usage_bytes': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'snapshot_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, - 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, - 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, - 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'signed_identifiers': {'key': 'properties.signedIdentifiers', 'type': '[SignedIdentifier]'}, - 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItem, self).__init__(**kwargs) - self.last_modified_time = None - self.metadata = kwargs.get('metadata', None) - self.share_quota = kwargs.get('share_quota', None) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.root_squash = kwargs.get('root_squash', None) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.access_tier = kwargs.get('access_tier', None) - self.access_tier_change_time = None - self.access_tier_status = None - self.share_usage_bytes = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.signed_identifiers = kwargs.get('signed_identifiers', None) - self.snapshot_time = None - - -class FileShareItems(msrest.serialization.Model): - """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of shares. Returned when total - number of requested shares exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GeoReplicationStats(msrest.serialization.Model): - """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that - the secondary location is active and operational. - Bootstrap: Indicates initial - synchronization from the primary location to the secondary location is in progress.This - typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary - location is temporarily unavailable. Possible values include: "Live", "Bootstrap", - "Unavailable". - :vartype status: str or ~azure.mgmt.storage.v2021_06_01.models.GeoReplicationStatus - :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to - be available for read operations. Primary writes following this point in time may or may not be - available for reads. Element may be default value if value of LastSyncTime is not available, - this can happen if secondary is offline or we are in bootstrap. - :vartype last_sync_time: ~datetime.datetime - :ivar can_failover: A boolean flag which indicates whether or not account failover is supported - for the account. - :vartype can_failover: bool - """ - - _validation = { - 'status': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - 'can_failover': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'can_failover': {'key': 'canFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoReplicationStats, self).__init__(**kwargs) - self.status = None - self.last_sync_time = None - self.can_failover = None - - -class Identity(msrest.serialization.Model): - """Identity for the 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 principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM - resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, - ~azure.mgmt.storage.v2021_06_01.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': 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': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImmutabilityPolicy(AzureEntityResource): - """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - :param allow_protected_append_writes_all: This property can only be changed for unlocked - time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock - Blobs' while maintaining immutability protection and compliance. Only new blocks can be added - and any existing blocks cannot be modified or deleted. This property cannot be changed with - ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and - 'allowProtectedAppendWritesAll' properties are mutually exclusive. - :type allow_protected_append_writes_all: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - 'allow_protected_append_writes_all': {'key': 'properties.allowProtectedAppendWritesAll', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicy, self).__init__(**kwargs) - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - self.allow_protected_append_writes_all = kwargs.get('allow_protected_append_writes_all', None) - - -class ImmutabilityPolicyProperties(msrest.serialization.Model): - """The properties of an ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar etag: ImmutabilityPolicy Etag. - :vartype etag: str - :ivar update_history: The ImmutabilityPolicy update history of the blob container. - :vartype update_history: list[~azure.mgmt.storage.v2021_06_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked - and Unlocked. Possible values include: "Locked", "Unlocked". - :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - :param allow_protected_append_writes_all: This property can only be changed for unlocked - time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock - Blobs' while maintaining immutability protection and compliance. Only new blocks can be added - and any existing blocks cannot be modified or deleted. This property cannot be changed with - ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and - 'allowProtectedAppendWritesAll' properties are mutually exclusive. - :type allow_protected_append_writes_all: bool - """ - - _validation = { - 'etag': {'readonly': True}, - 'update_history': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, - 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, - 'allow_protected_append_writes_all': {'key': 'properties.allowProtectedAppendWritesAll', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutabilityPolicyProperties, self).__init__(**kwargs) - self.etag = None - self.update_history = None - self.immutability_period_since_creation_in_days = kwargs.get('immutability_period_since_creation_in_days', None) - self.state = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - self.allow_protected_append_writes_all = kwargs.get('allow_protected_append_writes_all', None) - - -class ImmutableStorageAccount(msrest.serialization.Model): - """This property enables and defines account-level immutability. Enabling the feature auto-enables Blob Versioning. - - :param enabled: A boolean flag which enables account-level immutability. All the containers - under such an account have object-level immutability enabled by default. - :type enabled: bool - :param immutability_policy: Specifies the default account-level immutability policy which is - inherited and applied to objects that do not possess an explicit immutability policy at the - object level. The object-level immutability policy has higher precedence than the - container-level immutability policy, which has a higher precedence than the account-level - immutability policy. - :type immutability_policy: - ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyProperties - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'immutability_policy': {'key': 'immutabilityPolicy', 'type': 'AccountImmutabilityPolicyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutableStorageAccount, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.immutability_policy = kwargs.get('immutability_policy', None) - - -class ImmutableStorageWithVersioning(msrest.serialization.Model): - """Object level immutability properties of the container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: This is an immutable property, when set to true it enables object level - immutability at the container level. - :type enabled: bool - :ivar time_stamp: Returns the date and time the object level immutability was enabled. - :vartype time_stamp: ~datetime.datetime - :ivar migration_state: This property denotes the container level immutability to object level - immutability migration state. Possible values include: "InProgress", "Completed". - :vartype migration_state: str or ~azure.mgmt.storage.v2021_06_01.models.MigrationState - """ - - _validation = { - 'time_stamp': {'readonly': True}, - 'migration_state': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, - 'migration_state': {'key': 'migrationState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImmutableStorageWithVersioning, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.time_stamp = None - self.migration_state = None - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and - "Allow". The default value is None. - :type action: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.ip_address_or_range = kwargs['ip_address_or_range'] - self.action = kwargs.get('action', None) - - -class KeyCreationTime(msrest.serialization.Model): - """Storage account keys creation time. - - :param key1: - :type key1: ~datetime.datetime - :param key2: - :type key2: ~datetime.datetime - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'iso-8601'}, - 'key2': {'key': 'key2', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyCreationTime, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) - - -class KeyPolicy(msrest.serialization.Model): - """KeyPolicy assigned to the storage account. - - All required parameters must be populated in order to send to Azure. - - :param key_expiration_period_in_days: Required. The key expiration period in days. - :type key_expiration_period_in_days: int - """ - - _validation = { - 'key_expiration_period_in_days': {'required': True}, - } - - _attribute_map = { - 'key_expiration_period_in_days': {'key': 'keyExpirationPeriodInDays', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyPolicy, self).__init__(**kwargs) - self.key_expiration_period_in_days = kwargs['key_expiration_period_in_days'] - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - :ivar current_versioned_key_identifier: The object identifier of the current versioned Key - Vault Key in use. - :vartype current_versioned_key_identifier: str - :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'current_versioned_key_identifier': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyname', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.current_versioned_key_identifier = None - self.last_key_rotation_timestamp = None - - -class LastAccessTimeTrackingPolicy(msrest.serialization.Model): - """The blob service properties for Last access time based tracking policy. - - All required parameters must be populated in order to send to Azure. - - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently - read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_06_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in - days, typically how often the blob object should be tracked.This field is currently read only - with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported - value. This field is currently read only. - :type blob_type: list[str] - """ - - _validation = { - 'enable': {'required': True}, - } - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, - 'blob_type': {'key': 'blobType', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) - self.enable = kwargs['enable'] - self.name = kwargs.get('name', None) - self.tracking_granularity_in_days = kwargs.get('tracking_granularity_in_days', None) - self.blob_type = kwargs.get('blob_type', None) - - -class LeaseContainerRequest(msrest.serialization.Model): - """Lease Container request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseContainerResponse(msrest.serialization.Model): - """Lease Container response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseContainerResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LeaseShareRequest(msrest.serialization.Model): - """Lease Share request schema. - - All required parameters must be populated in order to send to Azure. - - :param action: Required. Specifies the lease action. Can be one of the available actions. - Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseShareAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue - before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a - GUID string format. - :type proposed_lease_id: str - """ - - _validation = { - 'action': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'break_period': {'key': 'breakPeriod', 'type': 'int'}, - 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, - 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseShareRequest, self).__init__(**kwargs) - self.action = kwargs['action'] - self.lease_id = kwargs.get('lease_id', None) - self.break_period = kwargs.get('break_period', None) - self.lease_duration = kwargs.get('lease_duration', None) - self.proposed_lease_id = kwargs.get('proposed_lease_id', None) - - -class LeaseShareResponse(msrest.serialization.Model): - """Lease Share response schema. - - :param lease_id: Returned unique lease ID that must be included with any request to delete the - share, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str - """ - - _attribute_map = { - 'lease_id': {'key': 'leaseId', 'type': 'str'}, - 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LeaseShareResponse, self).__init__(**kwargs) - self.lease_id = kwargs.get('lease_id', None) - self.lease_time_seconds = kwargs.get('lease_time_seconds', None) - - -class LegalHold(msrest.serialization.Model): - """The LegalHold property of a blob container. - - 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is - normalized to lower case at SRP. - :type tags: list[str] - :param allow_protected_append_writes_all: When enabled, new blocks can be written to both - 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks - can be added and any existing blocks cannot be modified or deleted. - :type allow_protected_append_writes_all: bool - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - 'tags': {'required': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - 'allow_protected_append_writes_all': {'key': 'allowProtectedAppendWritesAll', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHold, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs['tags'] - self.allow_protected_append_writes_all = kwargs.get('allow_protected_append_writes_all', None) - - -class LegalHoldProperties(msrest.serialization.Model): - """The LegalHold property of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_06_01.models.TagProperty] - :param protected_append_writes_history: Protected append blob writes history. - :type protected_append_writes_history: - ~azure.mgmt.storage.v2021_06_01.models.ProtectedAppendWritesHistory - """ - - _validation = { - 'has_legal_hold': {'readonly': True}, - } - - _attribute_map = { - 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '[TagProperty]'}, - 'protected_append_writes_history': {'key': 'protectedAppendWritesHistory', 'type': 'ProtectedAppendWritesHistory'}, - } - - def __init__( - self, - **kwargs - ): - super(LegalHoldProperties, self).__init__(**kwargs) - self.has_legal_hold = None - self.tags = kwargs.get('tags', None) - self.protected_append_writes_history = kwargs.get('protected_append_writes_history', None) - - -class ListAccountSasResponse(msrest.serialization.Model): - """The List SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_sas_token: List SAS credentials of storage account. - :vartype account_sas_token: str - """ - - _validation = { - 'account_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListAccountSasResponse, self).__init__(**kwargs) - self.account_sas_token = None - - -class ListBlobInventoryPolicy(msrest.serialization.Model): - """List of blob inventory policies returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blob inventory policies. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListBlobInventoryPolicy, self).__init__(**kwargs) - self.value = None - - -class ListContainerItem(AzureEntityResource): - """The blob container properties be listed out. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar version: The version of the deleted blob container. - :vartype version: str - :ivar deleted: Indicates whether the blob container was deleted. - :vartype deleted: bool - :ivar deleted_time: Blob container deletion time. - :vartype deleted_time: ~datetime.datetime - :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. - :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container - default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the - level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess - :ivar last_modified_time: Returns the date and time the container was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar lease_status: The lease status of the container. Possible values include: "Locked", - "Unlocked". - :vartype lease_status: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseStatus - :ivar lease_state: Lease state of the container. Possible values include: "Available", - "Leased", "Expired", "Breaking", "Broken". - :vartype lease_state: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseState - :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed - duration, only when the container is leased. Possible values include: "Infinite", "Fixed". - :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] - :ivar immutability_policy: The ImmutabilityPolicy property of the container. - :vartype immutability_policy: - ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyProperties - :ivar legal_hold: The LegalHold property of the container. - :vartype legal_hold: ~azure.mgmt.storage.v2021_06_01.models.LegalHoldProperties - :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at - least one existing tag. The hasLegalHold public property is set to false by SRP if all existing - legal hold tags are cleared out. There can be a maximum of 1000 blob containers with - hasLegalHold=true for a given account. - :vartype has_legal_hold: bool - :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP - if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public - property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the - container. The property is immutable and can only be set to true at the container creation - time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageWithVersioning - :param enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. - :type enable_nfs_v3_root_squash: bool - :param enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. - :type enable_nfs_v3_all_squash: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'version': {'readonly': True}, - 'deleted': {'readonly': True}, - 'deleted_time': {'readonly': True}, - 'remaining_retention_days': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'lease_status': {'readonly': True}, - 'lease_state': {'readonly': True}, - 'lease_duration': {'readonly': True}, - 'immutability_policy': {'readonly': True}, - 'legal_hold': {'readonly': True}, - 'has_legal_hold': {'readonly': True}, - 'has_immutability_policy': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, - 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, - 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, - 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, - 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, - 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, - 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, - 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, - 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, - 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, - 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageWithVersioning'}, - 'enable_nfs_v3_root_squash': {'key': 'properties.enableNfsV3RootSquash', 'type': 'bool'}, - 'enable_nfs_v3_all_squash': {'key': 'properties.enableNfsV3AllSquash', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItem, self).__init__(**kwargs) - self.version = None - self.deleted = None - self.deleted_time = None - self.remaining_retention_days = None - self.default_encryption_scope = kwargs.get('default_encryption_scope', None) - self.deny_encryption_scope_override = kwargs.get('deny_encryption_scope_override', None) - self.public_access = kwargs.get('public_access', None) - self.last_modified_time = None - self.lease_status = None - self.lease_state = None - self.lease_duration = None - self.metadata = kwargs.get('metadata', None) - self.immutability_policy = None - self.legal_hold = None - self.has_legal_hold = None - self.has_immutability_policy = None - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - self.enable_nfs_v3_root_squash = kwargs.get('enable_nfs_v3_root_squash', None) - self.enable_nfs_v3_all_squash = kwargs.get('enable_nfs_v3_all_squash', None) - - -class ListContainerItems(msrest.serialization.Model): - """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of blobs containers returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.ListContainerItem] - :ivar next_link: Request URL that can be used to query next page of containers. Returned when - total number of requested containers exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListContainerItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueue(Resource): - """ListQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - - -class ListQueueResource(msrest.serialization.Model): - """Response schema. Contains list of queues returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queues returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.ListQueue] - :ivar next_link: Request URL that can be used to list next page of queues. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ListQueue]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListQueueServices(msrest.serialization.Model): - """ListQueueServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of queue services returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.QueueServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListQueueServices, self).__init__(**kwargs) - self.value = None - - -class ListServiceSasResponse(msrest.serialization.Model): - """The List service SAS credentials operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_sas_token: List service SAS credentials of specific resource. - :vartype service_sas_token: str - """ - - _validation = { - 'service_sas_token': {'readonly': True}, - } - - _attribute_map = { - 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListServiceSasResponse, self).__init__(**kwargs) - self.service_sas_token = None - - -class ListTableResource(msrest.serialization.Model): - """Response schema. Contains list of tables returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of tables returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.Table] - :ivar next_link: Request URL that can be used to query next page of tables. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Table]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableResource, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ListTableServices(msrest.serialization.Model): - """ListTableServices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of table services returned. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.TableServiceProperties] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListTableServices, self).__init__(**kwargs) - self.value = None - - -class ManagementPolicy(Resource): - """The Get Storage Account ManagementPolicies operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. - :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySchema - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, - 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicy, self).__init__(**kwargs) - self.last_modified_time = None - self.policy = kwargs.get('policy', None) - - -class ManagementPolicyAction(msrest.serialization.Model): - """Actions are applied to the filtered blobs when the execution condition is met. - - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyVersion - """ - - _attribute_map = { - 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, - 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, - 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyAction, self).__init__(**kwargs) - self.base_blob = kwargs.get('base_blob', None) - self.snapshot = kwargs.get('snapshot', None) - self.version = kwargs.get('version', None) - - -class ManagementPolicyBaseBlob(msrest.serialization.Model): - """Management policy action for base blob. - - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot - tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently - at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, - 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, - 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyBaseBlob, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - self.enable_auto_tier_to_hot_from_cool = kwargs.get('enable_auto_tier_to_hot_from_cool', None) - - -class ManagementPolicyDefinition(msrest.serialization.Model): - """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. - - All required parameters must be populated in order to send to Azure. - - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyFilter - """ - - _validation = { - 'actions': {'required': True}, - } - - _attribute_map = { - 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, - 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyDefinition, self).__init__(**kwargs) - self.actions = kwargs['actions'] - self.filters = kwargs.get('filters', None) - - -class ManagementPolicyFilter(msrest.serialization.Model): - """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. - - All required parameters must be populated in order to send to Azure. - - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports - all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag - filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_06_01.models.TagFilter] - """ - - _validation = { - 'blob_types': {'required': True}, - } - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, - 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.blob_types = kwargs['blob_types'] - self.blob_index_match = kwargs.get('blob_index_match', None) - - -class ManagementPolicyRule(msrest.serialization.Model): - """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyDefinition - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyRule, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.definition = kwargs['definition'] - - -class ManagementPolicySchema(msrest.serialization.Model): - """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - - All required parameters must be populated in order to send to Azure. - - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: - https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySchema, self).__init__(**kwargs) - self.rules = kwargs['rules'] - - -class ManagementPolicySnapShot(msrest.serialization.Model): - """Management policy action for snapshot. - - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicySnapShot, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class ManagementPolicyVersion(msrest.serialization.Model): - """Management policy action for blob version. - - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version - currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob - version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - """ - - _attribute_map = { - 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, - 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, - 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagementPolicyVersion, self).__init__(**kwargs) - self.tier_to_cool = kwargs.get('tier_to_cool', None) - self.tier_to_archive = kwargs.get('tier_to_archive', None) - self.delete = kwargs.get('delete', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_06_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - - -class Multichannel(msrest.serialization.Model): - """Multichannel setting. Applies to Premium FileStorage only. - - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Multichannel, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """Network rule set. - - All required parameters must be populated in order to send to Azure. - - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_06_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_06_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_06_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_06_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other - rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_06_01.models.DefaultAction - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'resource_access_rules': {'key': 'resourceAccessRules', 'type': '[ResourceAccessRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', "AzureServices") - self.resource_access_rules = kwargs.get('resource_access_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.default_action = kwargs.get('default_action', "Allow") - - -class ObjectReplicationPolicies(msrest.serialization.Model): - """List storage account object replication policies. - - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicies, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ObjectReplicationPolicy(Resource): - """The replication policy between two storage accounts. Multiple rules can be defined in one policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar policy_id: A unique id for object replication policy. - :vartype policy_id: str - :ivar enabled_time: Indicates when the policy is enabled on the source account. - :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. It should be full resource id if - allowCrossTenantReplication set to false. - :type source_account: str - :param destination_account: Required. Destination account name. It should be full resource id - if allowCrossTenantReplication set to false. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyRule] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'enabled_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, - 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, - 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicy, self).__init__(**kwargs) - self.policy_id = None - self.enabled_time = None - self.source_account = kwargs.get('source_account', None) - self.destination_account = kwargs.get('destination_account', None) - self.rules = kwargs.get('rules', None) - - -class ObjectReplicationPolicyFilter(msrest.serialization.Model): - """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin - with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str - """ - - _attribute_map = { - 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, - 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) - self.prefix_match = kwargs.get('prefix_match', None) - self.min_creation_time = kwargs.get('min_creation_time', None) - - -class ObjectReplicationPolicyRule(msrest.serialization.Model): - """The replication policy rule between two containers. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is - required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyFilter - """ - - _validation = { - 'source_container': {'required': True}, - 'destination_container': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'source_container': {'key': 'sourceContainer', 'type': 'str'}, - 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReplicationPolicyRule, self).__init__(**kwargs) - self.rule_id = kwargs.get('rule_id', None) - self.source_container = kwargs['source_container'] - self.destination_container = kwargs['destination_container'] - self.filters = kwargs.get('filters', None) - - -class Operation(msrest.serialization.Model): - """Storage REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_06_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_06_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _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 = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :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(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.storage.v2021_06_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type action_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class ProtectedAppendWritesHistory(msrest.serialization.Model): - """Protected append writes history setting for the blob container with Legal holds. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param allow_protected_append_writes_all: When enabled, new blocks can be written to both - 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks - can be added and any existing blocks cannot be modified or deleted. - :type allow_protected_append_writes_all: bool - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'allow_protected_append_writes_all': {'key': 'allowProtectedAppendWritesAll', 'type': 'bool'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectedAppendWritesHistory, self).__init__(**kwargs) - self.allow_protected_append_writes_all = kwargs.get('allow_protected_append_writes_all', None) - self.timestamp = None - - -class ProtocolSettings(msrest.serialization.Model): - """Protocol settings for file service. - - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_06_01.models.SmbSetting - """ - - _attribute_map = { - 'smb': {'key': 'smb', 'type': 'SmbSetting'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtocolSettings, self).__init__(**kwargs) - self.smb = kwargs.get('smb', None) - - -class QueueServiceProperties(Resource): - """The properties of a storage account’s Queue service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(QueueServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class ResourceAccessRule(msrest.serialization.Model): - """Resource Access Rule. - - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceAccessRule, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.resource_id = kwargs.get('resource_id', None) - - -class RestorePolicyProperties(msrest.serialization.Model): - """The blob service properties for blob restore policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than - DeleteRetentionPolicy.days. - :type days: int - :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. - :vartype last_enabled_time: ~datetime.datetime - :ivar min_restore_time: Returns the minimum date and time that the restore can be started. - :vartype min_restore_time: ~datetime.datetime - """ - - _validation = { - 'enabled': {'required': True}, - 'days': {'maximum': 365, 'minimum': 1}, - 'last_enabled_time': {'readonly': True}, - 'min_restore_time': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, - 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, - 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePolicyProperties, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs.get('days', None) - self.last_enabled_time = None - self.min_restore_time = None - - -class Restriction(msrest.serialization.Model): - """The restriction because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. As of now only possible value for this is location. - :vartype type: str - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or - "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the - subscription does not belong to that quota. The "NotAvailableForSubscription" is related to - capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_06_01.models.ReasonCode - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Restriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = kwargs.get('reason_code', None) - - -class RoutingPreference(msrest.serialization.Model): - """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. - Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_06_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing - storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing - storage endpoints are to be published. - :type publish_internet_endpoints: bool - """ - - _attribute_map = { - 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, - 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, - 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingPreference, self).__init__(**kwargs) - self.routing_choice = kwargs.get('routing_choice', None) - self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) - self.publish_internet_endpoints = kwargs.get('publish_internet_endpoints', None) - - -class SasPolicy(msrest.serialization.Model): - """SasPolicy assigned to the storage account. - - All required parameters must be populated in order to send to Azure. - - :param sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. - :type sas_expiration_period: str - :param expiration_action: Required. The SAS expiration action. Can only be Log. Possible values - include: "Log". Default value: "Log". - :type expiration_action: str or ~azure.mgmt.storage.v2021_06_01.models.ExpirationAction - """ - - _validation = { - 'sas_expiration_period': {'required': True}, - 'expiration_action': {'required': True}, - } - - _attribute_map = { - 'sas_expiration_period': {'key': 'sasExpirationPeriod', 'type': 'str'}, - 'expiration_action': {'key': 'expirationAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SasPolicy, self).__init__(**kwargs) - self.sas_expiration_period = kwargs['sas_expiration_period'] - self.expiration_action = kwargs.get('expiration_action', "Log") - - -class ServiceSasParameters(msrest.serialization.Model): - """The parameters to list service SAS credentials of a specific resource. - - All required parameters must be populated in order to send to Azure. - - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: - Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read - (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible - values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept - requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible - values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access - policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str - """ - - _validation = { - 'canonicalized_resource': {'required': True}, - 'identifier': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, - 'resource': {'key': 'signedResource', 'type': 'str'}, - 'permissions': {'key': 'signedPermission', 'type': 'str'}, - 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, - 'protocols': {'key': 'signedProtocol', 'type': 'str'}, - 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, - 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, - 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, - 'partition_key_start': {'key': 'startPk', 'type': 'str'}, - 'partition_key_end': {'key': 'endPk', 'type': 'str'}, - 'row_key_start': {'key': 'startRk', 'type': 'str'}, - 'row_key_end': {'key': 'endRk', 'type': 'str'}, - 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, - 'cache_control': {'key': 'rscc', 'type': 'str'}, - 'content_disposition': {'key': 'rscd', 'type': 'str'}, - 'content_encoding': {'key': 'rsce', 'type': 'str'}, - 'content_language': {'key': 'rscl', 'type': 'str'}, - 'content_type': {'key': 'rsct', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSasParameters, self).__init__(**kwargs) - self.canonicalized_resource = kwargs['canonicalized_resource'] - self.resource = kwargs.get('resource', None) - self.permissions = kwargs.get('permissions', None) - self.ip_address_or_range = kwargs.get('ip_address_or_range', None) - self.protocols = kwargs.get('protocols', None) - self.shared_access_start_time = kwargs.get('shared_access_start_time', None) - self.shared_access_expiry_time = kwargs.get('shared_access_expiry_time', None) - self.identifier = kwargs.get('identifier', None) - self.partition_key_start = kwargs.get('partition_key_start', None) - self.partition_key_end = kwargs.get('partition_key_end', None) - self.row_key_start = kwargs.get('row_key_start', None) - self.row_key_end = kwargs.get('row_key_end', None) - self.key_to_sign = kwargs.get('key_to_sign', None) - self.cache_control = kwargs.get('cache_control', None) - self.content_disposition = kwargs.get('content_disposition', None) - self.content_encoding = kwargs.get('content_encoding', None) - self.content_language = kwargs.get('content_language', None) - self.content_type = kwargs.get('content_type', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_06_01.models.MetricSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class SignedIdentifier(msrest.serialization.Model): - """SignedIdentifier. - - :param id: An unique identifier of the stored access policy. - :type id: str - :param access_policy: Access policy. - :type access_policy: ~azure.mgmt.storage.v2021_06_01.models.AccessPolicy - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'access_policy': {'key': 'accessPolicy', 'type': 'AccessPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(SignedIdentifier, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.access_policy = kwargs.get('access_policy', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_06_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SKUCapability(msrest.serialization.Model): - """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of capability, The capability information in the specified SKU, including - file encryption, network ACLs, change notification, etc. - :vartype name: str - :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuInformation(msrest.serialization.Model): - """Storage SKU and its 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. - - :param name: Required. The SKU name. Required for account creation; optional for update. Note - that in older versions, SKU name was called accountType. Possible values include: - "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", - "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName - :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", - "Premium". - :vartype tier: str or ~azure.mgmt.storage.v2021_06_01.models.SkuTier - :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. - :vartype resource_type: str - :ivar kind: Indicates the type of storage account. Possible values include: "Storage", - "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :ivar locations: The set of locations that the SKU is available. This will be supported and - registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - :vartype locations: list[str] - :ivar capabilities: The capability information in the specified SKU, including file encryption, - network ACLs, change notification, etc. - :vartype capabilities: list[~azure.mgmt.storage.v2021_06_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if - there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_06_01.models.Restriction] - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - self.resource_type = None - self.kind = None - self.locations = None - self.capabilities = None - self.restrictions = kwargs.get('restrictions', None) - - -class SmbSetting(msrest.serialization.Model): - """Setting for SMB protocol. - - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_06_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, - SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are - NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values - are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are - AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str - """ - - _attribute_map = { - 'multichannel': {'key': 'multichannel', 'type': 'Multichannel'}, - 'versions': {'key': 'versions', 'type': 'str'}, - 'authentication_methods': {'key': 'authenticationMethods', 'type': 'str'}, - 'kerberos_ticket_encryption': {'key': 'kerberosTicketEncryption', 'type': 'str'}, - 'channel_encryption': {'key': 'channelEncryption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SmbSetting, self).__init__(**kwargs) - self.multichannel = kwargs.get('multichannel', None) - self.versions = kwargs.get('versions', None) - self.authentication_methods = kwargs.get('authentication_methods', None) - self.kerberos_ticket_encryption = kwargs.get('kerberos_ticket_encryption', None) - self.channel_encryption = kwargs.get('channel_encryption', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class StorageAccount(TrackedResource): - """The storage account. - - 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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar sku: Gets the SKU. - :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :vartype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_06_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation - :ivar provisioning_state: Gets the status of the storage account at the time the operation was - called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_06_01.models.ProvisioningState - :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob - endpoint. - :vartype primary_endpoints: ~azure.mgmt.storage.v2021_06_01.models.Endpoints - :ivar primary_location: Gets the location of the primary data center for the storage account. - :vartype primary_location: str - :ivar status_of_primary: Gets the status indicating whether the primary location of the storage - account is available or unavailable. Possible values include: "available", "unavailable". - :vartype status_of_primary: str or ~azure.mgmt.storage.v2021_06_01.models.AccountStatus - :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to - the secondary location. Only the most recent timestamp is retained. This element is not - returned if there has never been a failover instance. Only available if the accountType is - Standard_GRS or Standard_RAGRS. - :vartype last_geo_failover_time: ~datetime.datetime - :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage - account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - :vartype secondary_location: str - :ivar status_of_secondary: Gets the status indicating whether the secondary location of the - storage account is available or unavailable. Only available if the SKU name is Standard_GRS or - Standard_RAGRS. Possible values include: "available", "unavailable". - :vartype status_of_secondary: str or ~azure.mgmt.storage.v2021_06_01.models.AccountStatus - :ivar creation_time: Gets the creation date and time of the storage account in UTC. - :vartype creation_time: ~datetime.datetime - :ivar custom_domain: Gets the custom domain the user assigned to this storage account. - :vartype custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain - :ivar sas_policy: SasPolicy assigned to the storage account. - :vartype sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy - :ivar key_policy: KeyPolicy assigned to the storage account. - :vartype key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy - :ivar key_creation_time: Storage account keys creation time. - :vartype key_creation_time: ~azure.mgmt.storage.v2021_06_01.models.KeyCreationTime - :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, - queue, or table object from the secondary location of the storage account. Only available if - the SKU name is Standard_RAGRS. - :vartype secondary_endpoints: ~azure.mgmt.storage.v2021_06_01.models.Endpoints - :ivar encryption: Gets the encryption settings on the account. If unspecified, the account is - unencrypted. - :vartype encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption - :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used - for billing. Possible values include: "Hot", "Cool". - :vartype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :ivar network_rule_set: Network rule set. - :vartype network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :ivar geo_replication_stats: Geo Replication Stats. - :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_06_01.models.GeoReplicationStats - :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, - it will be null. - :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState - :ivar private_endpoint_connections: List of private endpoint connection associated with the - specified storage account. - :vartype private_endpoint_connections: - list[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference - :ivar blob_restore_status: Blob restore status. - :vartype blob_restore_status: ~azure.mgmt.storage.v2021_06_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. - The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - :param default_to_o_auth_authentication: A boolean flag which indicates whether the default - authentication is OAuth or not. The default interpretation is false for this property. - :type default_to_o_auth_authentication: bool - :param public_network_access: Allow or disallow public network access to Storage Account. Value - is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: - "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess - :param immutable_storage_with_versioning: The property is immutable and can only be set to true - at the account creation time. When set to true, it enables object level immutability for all - the containers in the account by default. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'readonly': True}, - 'kind': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'primary_endpoints': {'readonly': True}, - 'primary_location': {'readonly': True}, - 'status_of_primary': {'readonly': True}, - 'last_geo_failover_time': {'readonly': True}, - 'secondary_location': {'readonly': True}, - 'status_of_secondary': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'custom_domain': {'readonly': True}, - 'sas_policy': {'readonly': True}, - 'key_policy': {'readonly': True}, - 'key_creation_time': {'readonly': True}, - 'secondary_endpoints': {'readonly': True}, - 'encryption': {'readonly': True}, - 'access_tier': {'readonly': True}, - 'network_rule_set': {'readonly': True}, - 'geo_replication_stats': {'readonly': True}, - 'failover_in_progress': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'blob_restore_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, - 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, - 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, - 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, - 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, - 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'key_creation_time': {'key': 'properties.keyCreationTime', 'type': 'KeyCreationTime'}, - 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, - 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, - 'default_to_o_auth_authentication': {'key': 'properties.defaultToOAuthAuthentication', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageAccount'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.sku = None - self.kind = None - self.identity = kwargs.get('identity', None) - self.extended_location = kwargs.get('extended_location', None) - self.provisioning_state = None - self.primary_endpoints = None - self.primary_location = None - self.status_of_primary = None - self.last_geo_failover_time = None - self.secondary_location = None - self.status_of_secondary = None - self.creation_time = None - self.custom_domain = None - self.sas_policy = None - self.key_policy = None - self.key_creation_time = None - self.secondary_endpoints = None - self.encryption = None - self.access_tier = None - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = None - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.geo_replication_stats = None - self.failover_in_progress = None - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.private_endpoint_connections = None - self.routing_preference = kwargs.get('routing_preference', None) - self.blob_restore_status = None - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - self.allow_cross_tenant_replication = kwargs.get('allow_cross_tenant_replication', None) - self.default_to_o_auth_authentication = kwargs.get('default_to_o_auth_authentication', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - - -class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the storage account name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The storage account name. - :type name: str - :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Storage/storageAccounts" - - def __init__( - self, - **kwargs - ): - super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class StorageAccountCreateParameters(msrest.serialization.Model): - """The parameters used when creating a storage account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, - etc.). The geo region of a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the - storage account will be created in Azure main region. Otherwise it will be created in the - specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used for viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no - greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_06_01.models.Identity - :param public_network_access: Allow or disallow public network access to Storage Account. Value - is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: - "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. - Only one custom domain is supported per storage account at this time. To clear the existing - custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts - and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. - The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - :param default_to_o_auth_authentication: A boolean flag which indicates whether the default - authentication is OAuth or not. The default interpretation is false for this property. - :type default_to_o_auth_authentication: bool - :param immutable_storage_with_versioning: The property is immutable and can only be set to true - at the account creation time. When set to true, it enables object level immutability for all - the new containers in the account by default. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount - """ - - _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, - 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, - 'default_to_o_auth_authentication': {'key': 'properties.defaultToOAuthAuthentication', 'type': 'bool'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageAccount'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.extended_location = kwargs.get('extended_location', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.sas_policy = kwargs.get('sas_policy', None) - self.key_policy = kwargs.get('key_policy', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.is_hns_enabled = kwargs.get('is_hns_enabled', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.enable_nfs_v3 = kwargs.get('enable_nfs_v3', None) - self.allow_cross_tenant_replication = kwargs.get('allow_cross_tenant_replication', None) - self.default_to_o_auth_authentication = kwargs.get('default_to_o_auth_authentication', None) - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - - -class StorageAccountInternetEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountInternetEndpoints, self).__init__(**kwargs) - self.blob = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountKey(msrest.serialization.Model): - """An access key for the storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Name of the key. - :vartype key_name: str - :ivar value: Base 64-encoded value of the key. - :vartype value: str - :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values - include: "Read", "Full". - :vartype permissions: str or ~azure.mgmt.storage.v2021_06_01.models.KeyPermission - :ivar creation_time: Creation time of the key, in round trip date format. - :vartype creation_time: ~datetime.datetime - """ - - _validation = { - 'key_name': {'readonly': True}, - 'value': {'readonly': True}, - 'permissions': {'readonly': True}, - 'creation_time': {'readonly': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountKey, self).__init__(**kwargs) - self.key_name = None - self.value = None - self.permissions = None - self.creation_time = None - - -class StorageAccountListKeysResult(msrest.serialization.Model): - """The response from the ListKeys operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar keys: Gets the list of storage account keys and their properties for the specified - storage account. - :vartype keys: list[~azure.mgmt.storage.v2021_06_01.models.StorageAccountKey] - """ - - _validation = { - 'keys': {'readonly': True}, - } - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListKeysResult, self).__init__(**kwargs) - self.keys = None - - -class StorageAccountListResult(msrest.serialization.Model): - """The response from the List Storage Accounts operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets the list of storage accounts and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.StorageAccount] - :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned - when total number of requested storage accounts exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): - """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob: Gets the blob endpoint. - :vartype blob: str - :ivar queue: Gets the queue endpoint. - :vartype queue: str - :ivar table: Gets the table endpoint. - :vartype table: str - :ivar file: Gets the file endpoint. - :vartype file: str - :ivar web: Gets the web endpoint. - :vartype web: str - :ivar dfs: Gets the dfs endpoint. - :vartype dfs: str - """ - - _validation = { - 'blob': {'readonly': True}, - 'queue': {'readonly': True}, - 'table': {'readonly': True}, - 'file': {'readonly': True}, - 'web': {'readonly': True}, - 'dfs': {'readonly': True}, - } - - _attribute_map = { - 'blob': {'key': 'blob', 'type': 'str'}, - 'queue': {'key': 'queue', 'type': 'str'}, - 'table': {'key': 'table', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'web': {'key': 'web', 'type': 'str'}, - 'dfs': {'key': 'dfs', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) - self.blob = None - self.queue = None - self.table = None - self.file = None - self.web = None - self.dfs = None - - -class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): - """The parameters used to regenerate the storage account key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class StorageAccountUpdateParameters(msrest.serialization.Model): - """The parameters that can be provided when updating the storage account properties. - - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_06_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value - supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", - "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the - CNAME source. Only one custom domain is supported per storage account at this time. To clear - the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is - unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication - settings for Azure Files. - :type azure_files_identity_based_authentication: - ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be - disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or - ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the - user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in - the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. - The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", - "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be - authorized with the account access key via Shared Key. If false, then all requests, including - shared access signatures, must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. - The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - :param default_to_o_auth_authentication: A boolean flag which indicates whether the default - authentication is OAuth or not. The default interpretation is false for this property. - :type default_to_o_auth_authentication: bool - :param public_network_access: Allow or disallow public network access to Storage Account. Value - is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: - "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess - :param immutable_storage_with_versioning: The property is immutable and can only be set to true - at the account creation time. When set to true, it enables object level immutability for all - the containers in the account by default. - :type immutable_storage_with_versioning: - ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, - 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, - 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, - 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, - 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, - 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, - 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, - 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, - 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, - 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, - 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, - 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, - 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, - 'default_to_o_auth_authentication': {'key': 'properties.defaultToOAuthAuthentication', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageAccount'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.custom_domain = kwargs.get('custom_domain', None) - self.encryption = kwargs.get('encryption', None) - self.sas_policy = kwargs.get('sas_policy', None) - self.key_policy = kwargs.get('key_policy', None) - self.access_tier = kwargs.get('access_tier', None) - self.azure_files_identity_based_authentication = kwargs.get('azure_files_identity_based_authentication', None) - self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.large_file_shares_state = kwargs.get('large_file_shares_state', None) - self.routing_preference = kwargs.get('routing_preference', None) - self.allow_blob_public_access = kwargs.get('allow_blob_public_access', None) - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.allow_shared_key_access = kwargs.get('allow_shared_key_access', None) - self.allow_cross_tenant_replication = kwargs.get('allow_cross_tenant_replication', None) - self.default_to_o_auth_authentication = kwargs.get('default_to_o_auth_authentication', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.immutable_storage_with_versioning = kwargs.get('immutable_storage_with_versioning', None) - - -class StorageQueue(Resource): - """StorageQueue. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] - :ivar approximate_message_count: Integer indicating an approximate number of messages in the - queue. This number is not lower than the actual number of messages in the queue, but could be - higher. - :vartype approximate_message_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'approximate_message_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, - 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageQueue, self).__init__(**kwargs) - self.metadata = kwargs.get('metadata', None) - self.approximate_message_count = None - - -class StorageSkuListResult(msrest.serialization.Model): - """The response from the List Storage SKUs operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Get the list result of storage SKUs and their properties. - :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.SkuInformation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageSkuListResult, self).__init__(**kwargs) - self.value = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_06_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_06_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Table(Resource): - """Properties of the table, including Id, resource name, resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar table_name: Table name under the specified account. - :vartype table_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'table_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Table, self).__init__(**kwargs) - self.table_name = None - - -class TableServiceProperties(Resource): - """The properties of a storage account’s Table service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule - elements in the request. If no CorsRule elements are included in the request body, all CORS - rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, - } - - def __init__( - self, - **kwargs - ): - super(TableServiceProperties, self).__init__(**kwargs) - self.cors = kwargs.get('cors', None) - - -class TagFilter(msrest.serialization.Model): - """Blob index tag based filtering for blob objects. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and - filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can - have 0 - 256 characters. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 128, 'min_length': 1}, - 'op': {'required': True}, - 'value': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'op': {'key': 'op', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagFilter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.op = kwargs['op'] - self.value = kwargs['value'] - - -class TagProperty(msrest.serialization.Model): - """A tag of the LegalHold of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tag: The tag value. - :vartype tag: str - :ivar timestamp: Returns the date and time the tag was added. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who added the tag. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who added the tag. - :vartype upn: str - """ - - _validation = { - 'tag': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'tag': {'key': 'tag', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TagProperty, self).__init__(**kwargs) - self.tag = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - - -class UpdateHistoryProperty(msrest.serialization.Model): - """An update history of the ImmutabilityPolicy of a blob container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: - put, lock and extend. Possible values include: "put", "lock", "extend". - :vartype update: str or ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyUpdateType - :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the - container since the policy creation, in days. - :vartype immutability_period_since_creation_in_days: int - :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. - :vartype timestamp: ~datetime.datetime - :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. - :vartype object_identifier: str - :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the - ImmutabilityPolicy. - :vartype tenant_id: str - :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - :vartype upn: str - :param allow_protected_append_writes: This property can only be changed for unlocked time-based - retention policies. When enabled, new blocks can be written to an append blob while maintaining - immutability protection and compliance. Only new blocks can be added and any existing blocks - cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy - API. - :type allow_protected_append_writes: bool - :param allow_protected_append_writes_all: This property can only be changed for unlocked - time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock - Blobs' while maintaining immutability protection and compliance. Only new blocks can be added - and any existing blocks cannot be modified or deleted. This property cannot be changed with - ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and - 'allowProtectedAppendWritesAll' properties are mutually exclusive. - :type allow_protected_append_writes_all: bool - """ - - _validation = { - 'update': {'readonly': True}, - 'immutability_period_since_creation_in_days': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'object_identifier': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'upn': {'readonly': True}, - } - - _attribute_map = { - 'update': {'key': 'update', 'type': 'str'}, - 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'upn': {'key': 'upn', 'type': 'str'}, - 'allow_protected_append_writes': {'key': 'allowProtectedAppendWrites', 'type': 'bool'}, - 'allow_protected_append_writes_all': {'key': 'allowProtectedAppendWritesAll', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateHistoryProperty, self).__init__(**kwargs) - self.update = None - self.immutability_period_since_creation_in_days = None - self.timestamp = None - self.object_identifier = None - self.tenant_id = None - self.upn = None - self.allow_protected_append_writes = kwargs.get('allow_protected_append_writes', None) - self.allow_protected_append_writes_all = kwargs.get('allow_protected_append_writes_all', None) - - -class Usage(msrest.serialization.Model): - """Describes Storage Resource Usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountsPerSecond", "BytesPerSecond". - :vartype unit: str or ~azure.mgmt.storage.v2021_06_01.models.UsageUnit - :ivar current_value: Gets the current count of the allocated resources in the subscription. - :vartype current_value: int - :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. - :vartype limit: int - :ivar name: Gets the name of the type of usage. - :vartype name: ~azure.mgmt.storage.v2021_06_01.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response from the List Usages operation. - - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UsageName(msrest.serialization.Model): - """The usage names that can be used; currently limited to StorageAccount. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Gets a string describing the resource name. - :vartype value: str - :ivar localized_value: Gets a localized string describing the resource name. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the identity. - :vartype principal_id: str - :ivar client_id: The client ID of the identity. - :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(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual Network rule. - - All required parameters must be populated in order to send to Azure. - - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are - None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "Provisioning", - "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_06_01.models.State - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - self.action = kwargs.get('action', None) - self.state = kwargs.get('state', None) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py index 59c6c288ff9d..ce59dceddf5f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py @@ -18,12 +18,12 @@ class AccessPolicy(msrest.serialization.Model): """AccessPolicy. - :param start_time: Start time of the access policy. - :type start_time: ~datetime.datetime - :param expiry_time: Expiry time of the access policy. - :type expiry_time: ~datetime.datetime - :param permission: List of abbreviated permissions. - :type permission: str + :ivar start_time: Start time of the access policy. + :vartype start_time: ~datetime.datetime + :ivar expiry_time: Expiry time of the access policy. + :vartype expiry_time: ~datetime.datetime + :ivar permission: List of abbreviated permissions. + :vartype permission: str """ _attribute_map = { @@ -40,6 +40,14 @@ def __init__( permission: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Start time of the access policy. + :paramtype start_time: ~datetime.datetime + :keyword expiry_time: Expiry time of the access policy. + :paramtype expiry_time: ~datetime.datetime + :keyword permission: List of abbreviated permissions. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start_time = start_time self.expiry_time = expiry_time @@ -49,22 +57,22 @@ def __init__( class AccountImmutabilityPolicyProperties(msrest.serialization.Model): """This defines account-level immutability policy properties. - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int - :param state: The ImmutabilityPolicy state defines the mode of the policy. Disabled state + :vartype immutability_period_since_creation_in_days: int + :ivar state: The ImmutabilityPolicy state defines the mode of the policy. Disabled state disables the policy, Unlocked state allows increase and decrease of immutability retention time and also allows toggling allowProtectedAppendWrites property, Locked state only allows the increase of the immutability retention time. A policy can only be created in a Disabled or Unlocked state and can be toggled between the two states. Only a policy in an Unlocked state can transition to a Locked state which cannot be reverted. Possible values include: "Unlocked", "Locked", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for disabled and + :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyState + :ivar allow_protected_append_writes: This property can only be changed for disabled and unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. - :type allow_protected_append_writes: bool + :vartype allow_protected_append_writes: bool """ _validation = { @@ -85,6 +93,24 @@ def __init__( allow_protected_append_writes: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword state: The ImmutabilityPolicy state defines the mode of the policy. Disabled state + disables the policy, Unlocked state allows increase and decrease of immutability retention time + and also allows toggling allowProtectedAppendWrites property, Locked state only allows the + increase of the immutability retention time. A policy can only be created in a Disabled or + Unlocked state and can be toggled between the two states. Only a policy in an Unlocked state + can transition to a Locked state which cannot be reverted. Possible values include: "Unlocked", + "Locked", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyState + :keyword allow_protected_append_writes: This property can only be changed for disabled and + unlocked time-based retention policies. When enabled, new blocks can be written to an append + blob while maintaining immutability protection and compliance. Only new blocks can be added and + any existing blocks cannot be modified or deleted. + :paramtype allow_protected_append_writes: bool + """ super(AccountImmutabilityPolicyProperties, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = state @@ -96,31 +122,31 @@ class AccountSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: Required. The signed services accessible with the account SAS. Possible values + :ivar services: Required. The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". - :type services: str or ~azure.mgmt.storage.v2021_06_01.models.Services - :param resource_types: Required. The signed resource types that are accessible with the account + :vartype services: str or ~azure.mgmt.storage.v2021_06_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: "s", "c", "o". - :type resource_types: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResourceTypes - :param permissions: Required. The signed permissions for the account SAS. Possible values + :vartype resource_types: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: Required. The time at which the shared access signature + :vartype protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature becomes invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str """ _validation = { @@ -154,6 +180,34 @@ def __init__( key_to_sign: Optional[str] = None, **kwargs ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2021_06_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ super(AccountSasParameters, self).__init__(**kwargs) self.services = services self.resource_types = resource_types @@ -170,19 +224,19 @@ class ActiveDirectoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param domain_name: Required. Specifies the primary domain that the AD DNS server is + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is authoritative for. - :type domain_name: str - :param net_bios_domain_name: Required. Specifies the NetBIOS domain name. - :type net_bios_domain_name: str - :param forest_name: Required. Specifies the Active Directory forest to get. - :type forest_name: str - :param domain_guid: Required. Specifies the domain GUID. - :type domain_guid: str - :param domain_sid: Required. Specifies the security identifier (SID). - :type domain_sid: str - :param azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. - :type azure_storage_sid: str + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str """ _validation = { @@ -214,6 +268,22 @@ def __init__( azure_storage_sid: str, **kwargs ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + """ super(ActiveDirectoryProperties, self).__init__(**kwargs) self.domain_name = domain_name self.net_bios_domain_name = net_bios_domain_name @@ -254,6 +324,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -295,6 +367,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -304,18 +378,18 @@ class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_service_options: Required. Indicates the directory service used. Possible + :ivar directory_service_options: Required. Indicates the directory service used. Possible values include: "None", "AADDS", "AD". - :type directory_service_options: str or + :vartype directory_service_options: str or ~azure.mgmt.storage.v2021_06_01.models.DirectoryServiceOptions - :param active_directory_properties: Required if choose AD. - :type active_directory_properties: + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: ~azure.mgmt.storage.v2021_06_01.models.ActiveDirectoryProperties - :param default_share_permission: Default share permission for users using Kerberos + :ivar default_share_permission: Default share permission for users using Kerberos authentication if RBAC role is not assigned. Possible values include: "None", "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", "StorageFileDataSmbShareElevatedContributor". - :type default_share_permission: str or + :vartype default_share_permission: str or ~azure.mgmt.storage.v2021_06_01.models.DefaultSharePermission """ @@ -337,6 +411,21 @@ def __init__( default_share_permission: Optional[Union[str, "DefaultSharePermission"]] = None, **kwargs ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2021_06_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2021_06_01.models.ActiveDirectoryProperties + :keyword default_share_permission: Default share permission for users using Kerberos + authentication if RBAC role is not assigned. Possible values include: "None", + "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", + "StorageFileDataSmbShareElevatedContributor". + :paramtype default_share_permission: str or + ~azure.mgmt.storage.v2021_06_01.models.DefaultSharePermission + """ super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) self.directory_service_options = directory_service_options self.active_directory_properties = active_directory_properties @@ -366,15 +455,15 @@ class BlobContainer(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -386,8 +475,8 @@ class BlobContainer(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyProperties @@ -402,15 +491,15 @@ class BlobContainer(AzureEntityResource): if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container. :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the + :ivar immutable_storage_with_versioning: The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageWithVersioning - :param enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. - :type enable_nfs_v3_root_squash: bool - :param enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. - :type enable_nfs_v3_all_squash: bool + :ivar enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :vartype enable_nfs_v3_root_squash: bool + :ivar enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :vartype enable_nfs_v3_all_squash: bool """ _validation = { @@ -470,6 +559,28 @@ def __init__( enable_nfs_v3_all_squash: Optional[bool] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + :keyword immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageWithVersioning + :keyword enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :paramtype enable_nfs_v3_root_squash: bool + :keyword enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :paramtype enable_nfs_v3_all_squash: bool + """ super(BlobContainer, self).__init__(**kwargs) self.version = None self.deleted = None @@ -509,9 +620,8 @@ class BlobInventoryPolicy(Resource): :vartype system_data: ~azure.mgmt.storage.v2021_06_01.models.SystemData :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. :vartype last_modified_time: ~datetime.datetime - :param policy: The storage account blob inventory policy object. It is composed of policy - rules. - :type policy: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicySchema + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicySchema """ _validation = { @@ -537,6 +647,11 @@ def __init__( policy: Optional["BlobInventoryPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicySchema + """ super(BlobInventoryPolicy, self).__init__(**kwargs) self.system_data = None self.last_modified_time = None @@ -548,19 +663,19 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyFilter - :param format: Required. This is a required field, it specifies the format for the inventory + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyFilter + :ivar format: Required. This is a required field, it specifies the format for the inventory files. Possible values include: "Csv", "Parquet". - :type format: str or ~azure.mgmt.storage.v2021_06_01.models.Format - :param schedule: Required. This is a required field. This field is used to schedule an - inventory formation. Possible values include: "Daily", "Weekly". - :type schedule: str or ~azure.mgmt.storage.v2021_06_01.models.Schedule - :param object_type: Required. This is a required field. This field specifies the scope of the + :vartype format: str or ~azure.mgmt.storage.v2021_06_01.models.Format + :ivar schedule: Required. This is a required field. This field is used to schedule an inventory + formation. Possible values include: "Daily", "Weekly". + :vartype schedule: str or ~azure.mgmt.storage.v2021_06_01.models.Schedule + :ivar object_type: Required. This is a required field. This field specifies the scope of the inventory created either at the blob or container level. Possible values include: "Blob", "Container". - :type object_type: str or ~azure.mgmt.storage.v2021_06_01.models.ObjectType - :param schema_fields: Required. This is a required field. This field specifies the fields and + :vartype object_type: str or ~azure.mgmt.storage.v2021_06_01.models.ObjectType + :ivar schema_fields: Required. This is a required field. This field specifies the fields and properties of the object to be included in the inventory. The Schema field value 'Name' is always required. The valid values for this field for the 'Blob' definition.objectType include 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, @@ -570,7 +685,7 @@ class BlobInventoryPolicyDefinition(msrest.serialization.Model): LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only for Hns enabled accounts.'Tags' field is only valid for non Hns accounts. - :type schema_fields: list[str] + :vartype schema_fields: list[str] """ _validation = { @@ -598,6 +713,31 @@ def __init__( filters: Optional["BlobInventoryPolicyFilter"] = None, **kwargs ): + """ + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyFilter + :keyword format: Required. This is a required field, it specifies the format for the inventory + files. Possible values include: "Csv", "Parquet". + :paramtype format: str or ~azure.mgmt.storage.v2021_06_01.models.Format + :keyword schedule: Required. This is a required field. This field is used to schedule an + inventory formation. Possible values include: "Daily", "Weekly". + :paramtype schedule: str or ~azure.mgmt.storage.v2021_06_01.models.Schedule + :keyword object_type: Required. This is a required field. This field specifies the scope of the + inventory created either at the blob or container level. Possible values include: "Blob", + "Container". + :paramtype object_type: str or ~azure.mgmt.storage.v2021_06_01.models.ObjectType + :keyword schema_fields: Required. This is a required field. This field specifies the fields and + properties of the object to be included in the inventory. The Schema field value 'Name' is + always required. The valid values for this field for the 'Blob' definition.objectType include + 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, + AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, hdi_isfolder, Owner, Group, + Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid + values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, + LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. + Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only + for Hns enabled accounts.'Tags' field is only valid for non Hns accounts. + :paramtype schema_fields: list[str] + """ super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) self.filters = filters self.format = format @@ -609,20 +749,20 @@ def __init__( class BlobInventoryPolicyFilter(msrest.serialization.Model): """An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. - :param prefix_match: An array of strings for blob prefixes to be matched. - :type prefix_match: list[str] - :param blob_types: An array of predefined enum values. Valid values include blockBlob, + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: An array of predefined enum values. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when definition.objectType property is set to 'Blob'. - :type blob_types: list[str] - :param include_blob_versions: Includes blob versions in blob inventory when value is set to + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value is set to true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this property is set to true, else they must be excluded. - :type include_blob_versions: bool - :param include_snapshots: Includes blob snapshots in blob inventory when value is set to true. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value is set to true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, else it must be excluded. - :type include_snapshots: bool + :vartype include_snapshots: bool """ _attribute_map = { @@ -641,6 +781,22 @@ def __init__( include_snapshots: Optional[bool] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when + definition.objectType property is set to 'Blob'. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value is set to + true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this + property is set to true, else they must be excluded. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value is set to + true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, + else it must be excluded. + :paramtype include_snapshots: bool + """ super(BlobInventoryPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -653,16 +809,16 @@ class BlobInventoryPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Rule is enabled when set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param destination: Required. Container name where blob inventory files are stored. Must be + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar destination: Required. Container name where blob inventory files are stored. Must be pre-created. - :type destination: str - :param definition: Required. An object that defines the blob inventory policy rule. - :type definition: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyDefinition + :vartype destination: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyDefinition """ _validation = { @@ -688,6 +844,18 @@ def __init__( definition: "BlobInventoryPolicyDefinition", **kwargs ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyDefinition + """ super(BlobInventoryPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -700,13 +868,13 @@ class BlobInventoryPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Policy is enabled if set to true. - :type enabled: bool - :param type: Required. The valid value is Inventory. Possible values include: "Inventory". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.InventoryRuleType - :param rules: Required. The storage account blob inventory policy rules. The rule is applied + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2021_06_01.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied when it is enabled. - :type rules: list[~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyRule] """ _validation = { @@ -729,6 +897,15 @@ def __init__( rules: List["BlobInventoryPolicyRule"], **kwargs ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2021_06_01.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyRule] + """ super(BlobInventoryPolicySchema, self).__init__(**kwargs) self.enabled = enabled self.type = type @@ -740,10 +917,10 @@ class BlobRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param time_to_restore: Required. Restore blob to the specified time. - :type time_to_restore: ~datetime.datetime - :param blob_ranges: Required. Blob ranges to restore. - :type blob_ranges: list[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreRange] + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreRange] """ _validation = { @@ -763,6 +940,12 @@ def __init__( blob_ranges: List["BlobRestoreRange"], **kwargs ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreRange] + """ super(BlobRestoreParameters, self).__init__(**kwargs) self.time_to_restore = time_to_restore self.blob_ranges = blob_ranges @@ -773,10 +956,10 @@ class BlobRestoreRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. This is inclusive. Empty means account start. - :type start_range: str - :param end_range: Required. Blob end range. This is exclusive. Empty means account end. - :type end_range: str + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str """ _validation = { @@ -796,6 +979,12 @@ def __init__( end_range: str, **kwargs ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ super(BlobRestoreRange, self).__init__(**kwargs) self.start_range = start_range self.end_range = end_range @@ -837,6 +1026,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -865,6 +1056,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -884,31 +1077,30 @@ class BlobServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules - :param default_service_version: DefaultServiceVersion indicates the default version to use for + :vartype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: The blob service properties for blob soft delete. - :type delete_retention_policy: ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy - :param is_versioning_enabled: Versioning is enabled if set to true. - :type is_versioning_enabled: bool - :param automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. - :type automatic_snapshot_policy_enabled: bool - :param change_feed: The blob service properties for change feed events. - :type change_feed: ~azure.mgmt.storage.v2021_06_01.models.ChangeFeed - :param restore_policy: The blob service properties for blob restore policy. - :type restore_policy: ~azure.mgmt.storage.v2021_06_01.models.RestorePolicyProperties - :param container_delete_retention_policy: The blob service properties for container soft - delete. - :type container_delete_retention_policy: + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2021_06_01.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2021_06_01.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy - :param last_access_time_tracking_policy: The blob service property to configure last access - time based tracking policy. - :type last_access_time_tracking_policy: + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: ~azure.mgmt.storage.v2021_06_01.models.LastAccessTimeTrackingPolicy """ @@ -949,6 +1141,36 @@ def __init__( last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2021_06_01.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: ~azure.mgmt.storage.v2021_06_01.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2021_06_01.models.LastAccessTimeTrackingPolicy + """ super(BlobServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -965,12 +1187,12 @@ def __init__( class ChangeFeed(msrest.serialization.Model): """The blob service properties for change feed events. - :param enabled: Indicates whether change feed event logging is enabled for the Blob service. - :type enabled: bool - :param retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - :type retention_in_days: int + :vartype retention_in_days: int """ _validation = { @@ -989,6 +1211,14 @@ def __init__( retention_in_days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ super(ChangeFeed, self).__init__(**kwargs) self.enabled = enabled self.retention_in_days = retention_in_days @@ -1027,6 +1257,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -1036,8 +1268,8 @@ def __init__( class CloudErrorAutoGenerated(msrest.serialization.Model): """An error response from the Storage service. - :param error: An error response from the Storage service. - :type error: ~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated + :ivar error: An error response from the Storage service. + :vartype error: ~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated """ _attribute_map = { @@ -1050,6 +1282,10 @@ def __init__( error: Optional["CloudErrorBodyAutoGenerated"] = None, **kwargs ): + """ + :keyword error: An error response from the Storage service. + :paramtype error: ~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated + """ super(CloudErrorAutoGenerated, self).__init__(**kwargs) self.error = error @@ -1057,17 +1293,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBody] """ _attribute_map = { @@ -1086,6 +1322,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1096,17 +1345,17 @@ def __init__( class CloudErrorBodyAutoGenerated(msrest.serialization.Model): """An error response from the Storage service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated] """ _attribute_map = { @@ -1125,6 +1374,19 @@ def __init__( details: Optional[List["CloudErrorBodyAutoGenerated"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_06_01.models.CloudErrorBodyAutoGenerated] + """ super(CloudErrorBodyAutoGenerated, self).__init__(**kwargs) self.code = code self.message = message @@ -1137,22 +1399,22 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. - :type allowed_origins: list[str] - :param allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - :type allowed_methods: list[str or + :vartype allowed_methods: list[str or ~azure.mgmt.storage.v2021_06_01.models.CorsRuleAllowedMethodsItem] - :param max_age_in_seconds: Required. Required if CorsRule element is present. The number of + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - :type max_age_in_seconds: int - :param exposed_headers: Required. Required if CorsRule element is present. A list of response + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response headers to expose to CORS clients. - :type exposed_headers: list[str] - :param allowed_headers: Required. Required if CorsRule element is present. A list of headers + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - :type allowed_headers: list[str] + :vartype allowed_headers: list[str] """ _validation = { @@ -1181,6 +1443,24 @@ def __init__( allowed_headers: List[str], **kwargs ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2021_06_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -1192,9 +1472,9 @@ def __init__( class CorsRules(msrest.serialization.Model): """Sets the CORS rules. You can include up to five CorsRule elements in the request. - :param cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the request. - :type cors_rules: list[~azure.mgmt.storage.v2021_06_01.models.CorsRule] + :vartype cors_rules: list[~azure.mgmt.storage.v2021_06_01.models.CorsRule] """ _attribute_map = { @@ -1207,6 +1487,11 @@ def __init__( cors_rules: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2021_06_01.models.CorsRule] + """ super(CorsRules, self).__init__(**kwargs) self.cors_rules = cors_rules @@ -1216,12 +1501,12 @@ class CustomDomain(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Gets or sets the custom domain name assigned to the storage account. - Name is the CNAME source. - :type name: str - :param use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - :type use_sub_domain_name: bool + :vartype use_sub_domain_name: bool """ _validation = { @@ -1240,6 +1525,14 @@ def __init__( use_sub_domain_name: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ super(CustomDomain, self).__init__(**kwargs) self.name = name self.use_sub_domain_name = use_sub_domain_name @@ -1250,9 +1543,9 @@ class DateAfterCreation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Value indicating the age in days after + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after creation. - :type days_after_creation_greater_than: float + :vartype days_after_creation_greater_than: float """ _validation = { @@ -1269,6 +1562,11 @@ def __init__( days_after_creation_greater_than: float, **kwargs ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -1276,13 +1574,13 @@ def __init__( class DateAfterModification(msrest.serialization.Model): """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. - :param days_after_modification_greater_than: Value indicating the age in days after last + :ivar days_after_modification_greater_than: Value indicating the age in days after last modification. - :type days_after_modification_greater_than: float - :param days_after_last_access_time_greater_than: Value indicating the age in days after last + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy. - :type days_after_last_access_time_greater_than: float + :vartype days_after_last_access_time_greater_than: float """ _validation = { @@ -1302,6 +1600,15 @@ def __init__( days_after_last_access_time_greater_than: Optional[float] = None, **kwargs ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than @@ -1338,6 +1645,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1393,6 +1702,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1427,6 +1738,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1437,12 +1750,12 @@ class DeletedShare(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param deleted_share_name: Required. Required. Identify the name of the deleted share that will + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will be restored. - :type deleted_share_name: str - :param deleted_share_version: Required. Required. Identify the version of the deleted share - that will be restored. - :type deleted_share_version: str + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str """ _validation = { @@ -1462,6 +1775,14 @@ def __init__( deleted_share_version: str, **kwargs ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ super(DeletedShare, self).__init__(**kwargs) self.deleted_share_name = deleted_share_name self.deleted_share_version = deleted_share_version @@ -1470,11 +1791,11 @@ def __init__( class DeleteRetentionPolicy(msrest.serialization.Model): """The service properties for soft delete. - :param enabled: Indicates whether DeleteRetentionPolicy is enabled. - :type enabled: bool - :param days: Indicates the number of days that the deleted item should be retained. The minimum + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - :type days: int + :vartype days: int """ _validation = { @@ -1493,6 +1814,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ super(DeleteRetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1501,10 +1829,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1519,6 +1847,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1529,19 +1863,19 @@ class Encryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param services: List of services which support encryption. - :type services: ~azure.mgmt.storage.v2021_06_01.models.EncryptionServices - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2021_06_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". - :type key_source: str or ~azure.mgmt.storage.v2021_06_01.models.KeySource - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :vartype key_source: str or ~azure.mgmt.storage.v2021_06_01.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool - :param key_vault_properties: Properties provided by key vault. - :type key_vault_properties: ~azure.mgmt.storage.v2021_06_01.models.KeyVaultProperties - :param encryption_identity: The identity to be used with service-side encryption at rest. - :type encryption_identity: ~azure.mgmt.storage.v2021_06_01.models.EncryptionIdentity + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_06_01.models.KeyVaultProperties + :ivar encryption_identity: The identity to be used with service-side encryption at rest. + :vartype encryption_identity: ~azure.mgmt.storage.v2021_06_01.models.EncryptionIdentity """ _validation = { @@ -1566,6 +1900,21 @@ def __init__( encryption_identity: Optional["EncryptionIdentity"] = None, **kwargs ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2021_06_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2021_06_01.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2021_06_01.models.KeyVaultProperties + :keyword encryption_identity: The identity to be used with service-side encryption at rest. + :paramtype encryption_identity: ~azure.mgmt.storage.v2021_06_01.models.EncryptionIdentity + """ super(Encryption, self).__init__(**kwargs) self.services = services self.key_source = key_source @@ -1577,9 +1926,9 @@ def __init__( class EncryptionIdentity(msrest.serialization.Model): """Encryption identity for the storage account. - :param encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to - be associated with server-side encryption on the storage account. - :type encryption_user_assigned_identity: str + :ivar encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to be + associated with server-side encryption on the storage account. + :vartype encryption_user_assigned_identity: str """ _attribute_map = { @@ -1592,6 +1941,11 @@ def __init__( encryption_user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to + be associated with server-side encryption on the storage account. + :paramtype encryption_user_assigned_identity: str + """ super(EncryptionIdentity, self).__init__(**kwargs) self.encryption_user_assigned_identity = encryption_user_assigned_identity @@ -1609,25 +1963,25 @@ class EncryptionScope(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param source: The provider for the encryption scope. Possible values (case-insensitive): + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", "Microsoft.KeyVault". - :type source: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeSource - :param state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + :vartype source: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeState + :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeState :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. :vartype creation_time: ~datetime.datetime :ivar last_modified_time: Gets the last modification date and time of the encryption scope in UTC. :vartype last_modified_time: ~datetime.datetime - :param key_vault_properties: The key vault properties for the encryption scope. This is a + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - :type key_vault_properties: + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeKeyVaultProperties - :param require_infrastructure_encryption: A boolean indicating whether or not the service + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - :type require_infrastructure_encryption: bool + :vartype require_infrastructure_encryption: bool """ _validation = { @@ -1659,6 +2013,22 @@ def __init__( require_infrastructure_encryption: Optional[bool] = None, **kwargs ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeKeyVaultProperties + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + """ super(EncryptionScope, self).__init__(**kwargs) self.source = source self.state = state @@ -1673,10 +2043,10 @@ class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_uri: The object identifier for a key vault key object. When applied, the encryption + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - :type key_uri: str + :vartype key_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -1701,6 +2071,12 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri self.current_versioned_key_identifier = None @@ -1733,6 +2109,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1743,17 +2121,17 @@ class EncryptionService(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: A boolean indicating whether or not the service encrypts the data as it is + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is stored. - :type enabled: bool + :vartype enabled: bool :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. :vartype last_enabled_time: ~datetime.datetime - :param key_type: Encryption key type to be used for the encryption service. 'Account' key type + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: "Service", "Account". - :type key_type: str or ~azure.mgmt.storage.v2021_06_01.models.KeyType + :vartype key_type: str or ~azure.mgmt.storage.v2021_06_01.models.KeyType """ _validation = { @@ -1773,6 +2151,15 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2021_06_01.models.KeyType + """ super(EncryptionService, self).__init__(**kwargs) self.enabled = enabled self.last_enabled_time = None @@ -1782,14 +2169,14 @@ def __init__( class EncryptionServices(msrest.serialization.Model): """A list of services that support encryption. - :param blob: The encryption function of the blob storage service. - :type blob: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - :param file: The encryption function of the file storage service. - :type file: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - :param table: The encryption function of the table storage service. - :type table: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService - :param queue: The encryption function of the queue storage service. - :type queue: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService """ _attribute_map = { @@ -1808,6 +2195,16 @@ def __init__( queue: Optional["EncryptionService"] = None, **kwargs ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2021_06_01.models.EncryptionService + """ super(EncryptionServices, self).__init__(**kwargs) self.blob = blob self.file = file @@ -1832,11 +2229,11 @@ class Endpoints(msrest.serialization.Model): :vartype web: str :ivar dfs: Gets the dfs endpoint. :vartype dfs: str - :param microsoft_endpoints: Gets the microsoft routing storage endpoints. - :type microsoft_endpoints: + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountMicrosoftEndpoints - :param internet_endpoints: Gets the internet routing storage endpoints. - :type internet_endpoints: + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountInternetEndpoints """ @@ -1867,6 +2264,14 @@ def __init__( internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, **kwargs ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2021_06_01.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2021_06_01.models.StorageAccountInternetEndpoints + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -1881,8 +2286,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the storage resource provider. - :param error: Azure Storage Resource Provider error response body. - :type error: ~azure.mgmt.storage.v2021_06_01.models.ErrorResponseBody + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2021_06_01.models.ErrorResponseBody """ _attribute_map = { @@ -1895,6 +2300,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2021_06_01.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1902,12 +2311,12 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body contract. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1922,6 +2331,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1930,10 +2347,10 @@ def __init__( class ExtendedLocation(msrest.serialization.Model): """The complex type of the extended location. - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocationTypes """ _attribute_map = { @@ -1948,6 +2365,12 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type @@ -1974,6 +2397,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1993,15 +2418,15 @@ class FileServiceProperties(Resource): :vartype type: str :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param cors: Specifies CORS rules for the File service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules - :param share_delete_retention_policy: The file service properties for share soft delete. - :type share_delete_retention_policy: + :vartype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy - :param protocol_settings: Protocol settings for file service. - :type protocol_settings: ~azure.mgmt.storage.v2021_06_01.models.ProtocolSettings + :ivar protocol_settings: Protocol settings for file service. + :vartype protocol_settings: ~azure.mgmt.storage.v2021_06_01.models.ProtocolSettings """ _validation = { @@ -2029,6 +2454,17 @@ def __init__( protocol_settings: Optional["ProtocolSettings"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2021_06_01.models.DeleteRetentionPolicy + :keyword protocol_settings: Protocol settings for file service. + :paramtype protocol_settings: ~azure.mgmt.storage.v2021_06_01.models.ProtocolSettings + """ super(FileServiceProperties, self).__init__(**kwargs) self.sku = None self.cors = cors @@ -2053,17 +2489,17 @@ class FileShare(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -2072,10 +2508,10 @@ class FileShare(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2092,8 +2528,8 @@ class FileShare(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] + :ivar signed_identifiers: List of stored access policies specified on the share. + :vartype signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares with expand param "snapshots". :vartype snapshot_time: ~datetime.datetime @@ -2155,6 +2591,25 @@ def __init__( signed_identifiers: Optional[List["SignedIdentifier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier + :keyword signed_identifiers: List of stored access policies specified on the share. + :paramtype signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] + """ super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2193,17 +2648,17 @@ class FileShareItem(AzureEntityResource): :vartype etag: str :ivar last_modified_time: Returns the date and time the share was last modified. :vartype last_modified_time: ~datetime.datetime - :param metadata: A name-value pair to associate with the share as metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - :type share_quota: int - :param enabled_protocols: The authentication protocol that is used for the file share. Can only + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: "SMB", "NFS". - :type enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols - :param root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType + :vartype root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType :ivar version: The version of the share. :vartype version: str :ivar deleted: Indicates whether the share was deleted. @@ -2212,10 +2667,10 @@ class FileShareItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. :vartype remaining_retention_days: int - :param access_tier: Access tier for specific share. GpV2 account can choose between + :ivar access_tier: Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: "TransactionOptimized", "Hot", "Cool", "Premium". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier + :vartype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier :ivar access_tier_change_time: Indicates the last modification time for share access tier. :vartype access_tier_change_time: ~datetime.datetime :ivar access_tier_status: Indicates if there is a pending transition for access tier. @@ -2232,8 +2687,8 @@ class FileShareItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param signed_identifiers: List of stored access policies specified on the share. - :type signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] + :ivar signed_identifiers: List of stored access policies specified on the share. + :vartype signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares with expand param "snapshots". :vartype snapshot_time: ~datetime.datetime @@ -2295,6 +2750,25 @@ def __init__( signed_identifiers: Optional[List["SignedIdentifier"]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_06_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_06_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.ShareAccessTier + :keyword signed_identifiers: List of stored access policies specified on the share. + :paramtype signed_identifiers: list[~azure.mgmt.storage.v2021_06_01.models.SignedIdentifier] + """ super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata @@ -2342,6 +2816,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2385,6 +2861,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2402,13 +2880,13 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: "None", "SystemAssigned", + :ivar type: Required. The identity type. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.IdentityType - :param user_assigned_identities: Gets or sets a list of key value pairs that describe the set - of User Assigned identities that will be used with this storage account. The key is the ARM + :vartype type: str or ~azure.mgmt.storage.v2021_06_01.models.IdentityType + :ivar user_assigned_identities: Gets or sets a list of key value pairs that describe the set of + User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.storage.v2021_06_01.models.UserAssignedIdentity] """ @@ -2432,6 +2910,16 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: Required. The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.storage.v2021_06_01.models.IdentityType + :keyword user_assigned_identities: Gets or sets a list of key value pairs that describe the set + of User Assigned identities that will be used with this storage account. The key is the ARM + resource identifier of the identity. Only 1 User Assigned identity is permitted here. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.storage.v2021_06_01.models.UserAssignedIdentity] + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2454,25 +2942,25 @@ class ImmutabilityPolicy(AzureEntityResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool - :param allow_protected_append_writes_all: This property can only be changed for unlocked + :vartype allow_protected_append_writes: bool + :ivar allow_protected_append_writes_all: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive. - :type allow_protected_append_writes_all: bool + :vartype allow_protected_append_writes_all: bool """ _validation = { @@ -2502,6 +2990,24 @@ def __init__( allow_protected_append_writes_all: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + :keyword allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :paramtype allow_protected_append_writes_all: bool + """ super(ImmutabilityPolicy, self).__init__(**kwargs) self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days self.state = None @@ -2518,25 +3024,25 @@ class ImmutabilityPolicyProperties(msrest.serialization.Model): :vartype etag: str :ivar update_history: The ImmutabilityPolicy update history of the blob container. :vartype update_history: list[~azure.mgmt.storage.v2021_06_01.models.UpdateHistoryProperty] - :param immutability_period_since_creation_in_days: The immutability period for the blobs in the + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the container since the policy creation, in days. - :type immutability_period_since_creation_in_days: int + :vartype immutability_period_since_creation_in_days: int :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: "Locked", "Unlocked". :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyState - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool - :param allow_protected_append_writes_all: This property can only be changed for unlocked + :vartype allow_protected_append_writes: bool + :ivar allow_protected_append_writes_all: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive. - :type allow_protected_append_writes_all: bool + :vartype allow_protected_append_writes_all: bool """ _validation = { @@ -2562,6 +3068,24 @@ def __init__( allow_protected_append_writes_all: Optional[bool] = None, **kwargs ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + :keyword allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :paramtype allow_protected_append_writes_all: bool + """ super(ImmutabilityPolicyProperties, self).__init__(**kwargs) self.etag = None self.update_history = None @@ -2574,15 +3098,15 @@ def __init__( class ImmutableStorageAccount(msrest.serialization.Model): """This property enables and defines account-level immutability. Enabling the feature auto-enables Blob Versioning. - :param enabled: A boolean flag which enables account-level immutability. All the containers + :ivar enabled: A boolean flag which enables account-level immutability. All the containers under such an account have object-level immutability enabled by default. - :type enabled: bool - :param immutability_policy: Specifies the default account-level immutability policy which is + :vartype enabled: bool + :ivar immutability_policy: Specifies the default account-level immutability policy which is inherited and applied to objects that do not possess an explicit immutability policy at the object level. The object-level immutability policy has higher precedence than the container-level immutability policy, which has a higher precedence than the account-level immutability policy. - :type immutability_policy: + :vartype immutability_policy: ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyProperties """ @@ -2598,6 +3122,18 @@ def __init__( immutability_policy: Optional["AccountImmutabilityPolicyProperties"] = None, **kwargs ): + """ + :keyword enabled: A boolean flag which enables account-level immutability. All the containers + under such an account have object-level immutability enabled by default. + :paramtype enabled: bool + :keyword immutability_policy: Specifies the default account-level immutability policy which is + inherited and applied to objects that do not possess an explicit immutability policy at the + object level. The object-level immutability policy has higher precedence than the + container-level immutability policy, which has a higher precedence than the account-level + immutability policy. + :paramtype immutability_policy: + ~azure.mgmt.storage.v2021_06_01.models.AccountImmutabilityPolicyProperties + """ super(ImmutableStorageAccount, self).__init__(**kwargs) self.enabled = enabled self.immutability_policy = immutability_policy @@ -2608,9 +3144,9 @@ class ImmutableStorageWithVersioning(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: This is an immutable property, when set to true it enables object level + :ivar enabled: This is an immutable property, when set to true it enables object level immutability at the container level. - :type enabled: bool + :vartype enabled: bool :ivar time_stamp: Returns the date and time the object level immutability was enabled. :vartype time_stamp: ~datetime.datetime :ivar migration_state: This property denotes the container level immutability to object level @@ -2635,6 +3171,11 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: This is an immutable property, when set to true it enables object level + immutability at the container level. + :paramtype enabled: bool + """ super(ImmutableStorageWithVersioning, self).__init__(**kwargs) self.enabled = enabled self.time_stamp = None @@ -2646,12 +3187,12 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str - :param action: The action of IP ACL rule. The only acceptable values to pass in are None and + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str + :vartype action: str """ _validation = { @@ -2670,6 +3211,14 @@ def __init__( action: Optional[str] = None, **kwargs ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ super(IPRule, self).__init__(**kwargs) self.ip_address_or_range = ip_address_or_range self.action = action @@ -2678,10 +3227,10 @@ def __init__( class KeyCreationTime(msrest.serialization.Model): """Storage account keys creation time. - :param key1: - :type key1: ~datetime.datetime - :param key2: - :type key2: ~datetime.datetime + :ivar key1: + :vartype key1: ~datetime.datetime + :ivar key2: + :vartype key2: ~datetime.datetime """ _attribute_map = { @@ -2696,6 +3245,12 @@ def __init__( key2: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ super(KeyCreationTime, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 @@ -2706,8 +3261,8 @@ class KeyPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_expiration_period_in_days: Required. The key expiration period in days. - :type key_expiration_period_in_days: int + :ivar key_expiration_period_in_days: Required. The key expiration period in days. + :vartype key_expiration_period_in_days: int """ _validation = { @@ -2724,6 +3279,10 @@ def __init__( key_expiration_period_in_days: int, **kwargs ): + """ + :keyword key_expiration_period_in_days: Required. The key expiration period in days. + :paramtype key_expiration_period_in_days: int + """ super(KeyPolicy, self).__init__(**kwargs) self.key_expiration_period_in_days = key_expiration_period_in_days @@ -2733,12 +3292,12 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str :ivar current_versioned_key_identifier: The object identifier of the current versioned Key Vault Key in use. :vartype current_versioned_key_identifier: str @@ -2767,6 +3326,14 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2780,18 +3347,18 @@ class LastAccessTimeTrackingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable: Required. When set to true last access time based tracking is enabled. - :type enable: bool - :param name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: "AccessTimeTracking". - :type name: str or ~azure.mgmt.storage.v2021_06_01.models.Name - :param tracking_granularity_in_days: The field specifies blob object tracking granularity in + :vartype name: str or ~azure.mgmt.storage.v2021_06_01.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1. - :type tracking_granularity_in_days: int - :param blob_type: An array of predefined supported blob types. Only blockBlob is the supported + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only. - :type blob_type: list[str] + :vartype blob_type: list[str] """ _validation = { @@ -2814,6 +3381,20 @@ def __init__( blob_type: Optional[List[str]] = None, **kwargs ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2021_06_01.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) self.enable = enable self.name = name @@ -2826,20 +3407,20 @@ class LeaseContainerRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerRequestAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2864,6 +3445,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseContainerRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2875,11 +3472,11 @@ def __init__( class LeaseContainerResponse(msrest.serialization.Model): """Lease Container response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2894,6 +3491,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseContainerResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2904,20 +3508,20 @@ class LeaseShareRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: Required. Specifies the lease action. Can be one of the available actions. + :ivar action: Required. Specifies the lease action. Can be one of the available actions. Possible values include: "Acquire", "Renew", "Change", "Release", "Break". - :type action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseShareAction - :param lease_id: Identifies the lease. Can be specified in any valid GUID string format. - :type lease_id: str - :param break_period: Optional. For a break action, proposed duration the lease should continue + :vartype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseShareAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - :type break_period: int - :param lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, - or negative one (-1) for a lease that never expires. - :type lease_duration: int - :param proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - :type proposed_lease_id: str + :vartype proposed_lease_id: str """ _validation = { @@ -2942,6 +3546,22 @@ def __init__( proposed_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseShareAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ super(LeaseShareRequest, self).__init__(**kwargs) self.action = action self.lease_id = lease_id @@ -2953,11 +3573,11 @@ def __init__( class LeaseShareResponse(msrest.serialization.Model): """Lease Share response schema. - :param lease_id: Returned unique lease ID that must be included with any request to delete the + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the share, or to renew, change, or release the lease. - :type lease_id: str - :param lease_time_seconds: Approximate time remaining in the lease period, in seconds. - :type lease_time_seconds: str + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str """ _attribute_map = { @@ -2972,6 +3592,13 @@ def __init__( lease_time_seconds: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the share, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ super(LeaseShareResponse, self).__init__(**kwargs) self.lease_id = lease_id self.lease_time_seconds = lease_time_seconds @@ -2989,13 +3616,13 @@ class LegalHold(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - :type tags: list[str] - :param allow_protected_append_writes_all: When enabled, new blocks can be written to both + :vartype tags: list[str] + :ivar allow_protected_append_writes_all: When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. - :type allow_protected_append_writes_all: bool + :vartype allow_protected_append_writes_all: bool """ _validation = { @@ -3016,6 +3643,15 @@ def __init__( allow_protected_append_writes_all: Optional[bool] = None, **kwargs ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + :keyword allow_protected_append_writes_all: When enabled, new blocks can be written to both + 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks + can be added and any existing blocks cannot be modified or deleted. + :paramtype allow_protected_append_writes_all: bool + """ super(LegalHold, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -3032,10 +3668,10 @@ class LegalHoldProperties(msrest.serialization.Model): legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. :vartype has_legal_hold: bool - :param tags: A set of tags. The list of LegalHold tags of a blob container. - :type tags: list[~azure.mgmt.storage.v2021_06_01.models.TagProperty] - :param protected_append_writes_history: Protected append blob writes history. - :type protected_append_writes_history: + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2021_06_01.models.TagProperty] + :ivar protected_append_writes_history: Protected append blob writes history. + :vartype protected_append_writes_history: ~azure.mgmt.storage.v2021_06_01.models.ProtectedAppendWritesHistory """ @@ -3056,6 +3692,13 @@ def __init__( protected_append_writes_history: Optional["ProtectedAppendWritesHistory"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2021_06_01.models.TagProperty] + :keyword protected_append_writes_history: Protected append blob writes history. + :paramtype protected_append_writes_history: + ~azure.mgmt.storage.v2021_06_01.models.ProtectedAppendWritesHistory + """ super(LegalHoldProperties, self).__init__(**kwargs) self.has_legal_hold = None self.tags = tags @@ -3083,6 +3726,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -3108,6 +3753,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -3135,15 +3782,15 @@ class ListContainerItem(AzureEntityResource): :vartype deleted_time: ~datetime.datetime :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. :vartype remaining_retention_days: int - :param default_encryption_scope: Default the container to use specified encryption scope for - all writes. - :type default_encryption_scope: str - :param deny_encryption_scope_override: Block override of encryption scope from the container + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container default. - :type deny_encryption_scope_override: bool - :param public_access: Specifies whether data in the container may be accessed publicly and the + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: "Container", "Blob", "None". - :type public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess + :vartype public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess :ivar last_modified_time: Returns the date and time the container was last modified. :vartype last_modified_time: ~datetime.datetime :ivar lease_status: The lease status of the container. Possible values include: "Locked", @@ -3155,8 +3802,8 @@ class ListContainerItem(AzureEntityResource): :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: "Infinite", "Fixed". :vartype lease_duration: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseDuration - :param metadata: A name-value pair to associate with the container as metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] :ivar immutability_policy: The ImmutabilityPolicy property of the container. :vartype immutability_policy: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicyProperties @@ -3171,15 +3818,15 @@ class ListContainerItem(AzureEntityResource): if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container. :vartype has_immutability_policy: bool - :param immutable_storage_with_versioning: The object level immutability property of the + :ivar immutable_storage_with_versioning: The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageWithVersioning - :param enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. - :type enable_nfs_v3_root_squash: bool - :param enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. - :type enable_nfs_v3_all_squash: bool + :ivar enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :vartype enable_nfs_v3_root_squash: bool + :ivar enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :vartype enable_nfs_v3_all_squash: bool """ _validation = { @@ -3239,6 +3886,28 @@ def __init__( enable_nfs_v3_all_squash: Optional[bool] = None, **kwargs ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + :keyword immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageWithVersioning + :keyword enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :paramtype enable_nfs_v3_root_squash: bool + :keyword enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :paramtype enable_nfs_v3_all_squash: bool + """ super(ListContainerItem, self).__init__(**kwargs) self.version = None self.deleted = None @@ -3287,6 +3956,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3305,8 +3976,8 @@ class ListQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] """ _validation = { @@ -3328,6 +3999,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = metadata @@ -3357,6 +4032,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3383,6 +4060,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -3408,6 +4087,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -3437,6 +4118,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3463,6 +4146,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -3482,9 +4167,9 @@ class ManagementPolicy(Resource): :vartype type: str :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. :vartype last_modified_time: ~datetime.datetime - :param policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type policy: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySchema + :vartype policy: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySchema """ _validation = { @@ -3508,6 +4193,11 @@ def __init__( policy: Optional["ManagementPolicySchema"] = None, **kwargs ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySchema + """ super(ManagementPolicy, self).__init__(**kwargs) self.last_modified_time = None self.policy = policy @@ -3516,12 +4206,12 @@ def __init__( class ManagementPolicyAction(msrest.serialization.Model): """Actions are applied to the filtered blobs when the execution condition is met. - :param base_blob: The management policy action for base blob. - :type base_blob: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyBaseBlob - :param snapshot: The management policy action for snapshot. - :type snapshot: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySnapShot - :param version: The management policy action for version. - :type version: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyVersion + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyVersion """ _attribute_map = { @@ -3538,6 +4228,14 @@ def __init__( version: Optional["ManagementPolicyVersion"] = None, **kwargs ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyVersion + """ super(ManagementPolicyAction, self).__init__(**kwargs) self.base_blob = base_blob self.snapshot = snapshot @@ -3547,18 +4245,17 @@ def __init__( class ManagementPolicyBaseBlob(msrest.serialization.Model): """Management policy action for base blob. - :param tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification - :param tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification - :param delete: The function to delete the blob. - :type delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification - :param enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from - cool to hot on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan. - :type enable_auto_tier_to_hot_from_cool: bool + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool """ _attribute_map = { @@ -3577,6 +4274,20 @@ def __init__( enable_auto_tier_to_hot_from_cool: Optional[bool] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ super(ManagementPolicyBaseBlob, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3589,10 +4300,10 @@ class ManagementPolicyDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param actions: Required. An object that defines the action set. - :type actions: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyAction - :param filters: An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyFilter + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyFilter """ _validation = { @@ -3611,6 +4322,12 @@ def __init__( filters: Optional["ManagementPolicyFilter"] = None, **kwargs ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyFilter + """ super(ManagementPolicyDefinition, self).__init__(**kwargs) self.actions = actions self.filters = filters @@ -3621,14 +4338,14 @@ class ManagementPolicyFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param prefix_match: An array of strings for prefixes to be match. - :type prefix_match: list[str] - :param blob_types: Required. An array of predefined enum values. Currently blockBlob supports + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - :type blob_types: list[str] - :param blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag filters. - :type blob_index_match: list[~azure.mgmt.storage.v2021_06_01.models.TagFilter] + :vartype blob_index_match: list[~azure.mgmt.storage.v2021_06_01.models.TagFilter] """ _validation = { @@ -3649,6 +4366,16 @@ def __init__( blob_index_match: Optional[List["TagFilter"]] = None, **kwargs ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2021_06_01.models.TagFilter] + """ super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types @@ -3660,15 +4387,15 @@ class ManagementPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Rule is enabled if set to true. - :type enabled: bool - :param name: Required. A rule name can contain any combination of alpha numeric characters. - Rule name is case-sensitive. It must be unique within a policy. - :type name: str - :param type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". - :type type: str or ~azure.mgmt.storage.v2021_06_01.models.RuleType - :param definition: Required. An object that defines the Lifecycle rule. - :type definition: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyDefinition + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2021_06_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyDefinition """ _validation = { @@ -3693,6 +4420,17 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2021_06_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyDefinition + """ super(ManagementPolicyRule, self).__init__(**kwargs) self.enabled = enabled self.name = name @@ -3705,9 +4443,9 @@ class ManagementPolicySchema(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - :type rules: list[~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyRule] + :vartype rules: list[~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyRule] """ _validation = { @@ -3724,6 +4462,11 @@ def __init__( rules: List["ManagementPolicyRule"], **kwargs ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyRule] + """ super(ManagementPolicySchema, self).__init__(**kwargs) self.rules = rules @@ -3731,14 +4474,14 @@ def __init__( class ManagementPolicySnapShot(msrest.serialization.Model): """Management policy action for snapshot. - :param tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param delete: The function to delete the blob snapshot. - :type delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation """ _attribute_map = { @@ -3755,6 +4498,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + """ super(ManagementPolicySnapShot, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3764,14 +4517,14 @@ def __init__( class ManagementPolicyVersion(msrest.serialization.Model): """Management policy action for blob version. - :param tier_to_cool: The function to tier blob version to cool storage. Support blob version + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version currently at Hot tier. - :type tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param tier_to_archive: The function to tier blob version to archive storage. Support blob + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier. - :type tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation - :param delete: The function to delete the blob version. - :type delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation """ _attribute_map = { @@ -3788,6 +4541,16 @@ def __init__( delete: Optional["DateAfterCreation"] = None, **kwargs ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2021_06_01.models.DateAfterCreation + """ super(ManagementPolicyVersion, self).__init__(**kwargs) self.tier_to_cool = tier_to_cool self.tier_to_archive = tier_to_archive @@ -3797,24 +4560,24 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.storage.v2021_06_01.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2021_06_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str """ _attribute_map = { @@ -3843,6 +4606,26 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2021_06_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3858,8 +4641,8 @@ def __init__( class Multichannel(msrest.serialization.Model): """Multichannel setting. Applies to Premium FileStorage only. - :param enabled: Indicates whether multichannel is enabled. - :type enabled: bool + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -3872,6 +4655,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = enabled @@ -3881,20 +4668,20 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. - Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, - Metrics"), or None to bypass none of those traffics. Possible values include: "None", - "Logging", "Metrics", "AzureServices". Default value: "AzureServices". - :type bypass: str or ~azure.mgmt.storage.v2021_06_01.models.Bypass - :param resource_access_rules: Sets the resource access rules. - :type resource_access_rules: list[~azure.mgmt.storage.v2021_06_01.models.ResourceAccessRule] - :param virtual_network_rules: Sets the virtual network rules. - :type virtual_network_rules: list[~azure.mgmt.storage.v2021_06_01.models.VirtualNetworkRule] - :param ip_rules: Sets the IP ACL rules. - :type ip_rules: list[~azure.mgmt.storage.v2021_06_01.models.IPRule] - :param default_action: Required. Specifies the default action of allow or deny when no other + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2021_06_01.models.Bypass + :ivar resource_access_rules: Sets the resource access rules. + :vartype resource_access_rules: list[~azure.mgmt.storage.v2021_06_01.models.ResourceAccessRule] + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2021_06_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2021_06_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.storage.v2021_06_01.models.DefaultAction + :vartype default_action: str or ~azure.mgmt.storage.v2021_06_01.models.DefaultAction """ _validation = { @@ -3919,6 +4706,24 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2021_06_01.models.Bypass + :keyword resource_access_rules: Sets the resource access rules. + :paramtype resource_access_rules: + list[~azure.mgmt.storage.v2021_06_01.models.ResourceAccessRule] + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2021_06_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2021_06_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2021_06_01.models.DefaultAction + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.resource_access_rules = resource_access_rules @@ -3930,8 +4735,8 @@ def __init__( class ObjectReplicationPolicies(msrest.serialization.Model): """List storage account object replication policies. - :param value: The replication policy between two storage accounts. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy] + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy] """ _attribute_map = { @@ -3944,6 +4749,10 @@ def __init__( value: Optional[List["ObjectReplicationPolicy"]] = None, **kwargs ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy] + """ super(ObjectReplicationPolicies, self).__init__(**kwargs) self.value = value @@ -3965,14 +4774,14 @@ class ObjectReplicationPolicy(Resource): :vartype policy_id: str :ivar enabled_time: Indicates when the policy is enabled on the source account. :vartype enabled_time: ~datetime.datetime - :param source_account: Required. Source account name. It should be full resource id if + :ivar source_account: Required. Source account name. It should be full resource id if + allowCrossTenantReplication set to false. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false. - :type source_account: str - :param destination_account: Required. Destination account name. It should be full resource id - if allowCrossTenantReplication set to false. - :type destination_account: str - :param rules: The storage account object replication rules. - :type rules: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyRule] + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyRule] """ _validation = { @@ -4002,6 +4811,16 @@ def __init__( rules: Optional[List["ObjectReplicationPolicyRule"]] = None, **kwargs ): + """ + :keyword source_account: Required. Source account name. It should be full resource id if + allowCrossTenantReplication set to false. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. It should be full resource id + if allowCrossTenantReplication set to false. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: list[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyRule] + """ super(ObjectReplicationPolicy, self).__init__(**kwargs) self.policy_id = None self.enabled_time = None @@ -4013,12 +4832,12 @@ def __init__( class ObjectReplicationPolicyFilter(msrest.serialization.Model): """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. - :param prefix_match: Optional. Filters the results to replicate only blobs whose names begin + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - :type prefix_match: list[str] - :param min_creation_time: Blobs created after the time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. - :type min_creation_time: str + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str """ _attribute_map = { @@ -4033,6 +4852,14 @@ def __init__( min_creation_time: Optional[str] = None, **kwargs ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.min_creation_time = min_creation_time @@ -4043,15 +4870,15 @@ class ObjectReplicationPolicyRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Rule Id is auto-generated for each new rule on destination account. It is + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - :type rule_id: str - :param source_container: Required. Required. Source container name. - :type source_container: str - :param destination_container: Required. Required. Destination container name. - :type destination_container: str - :param filters: Optional. An object that defines the filter set. - :type filters: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyFilter + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyFilter """ _validation = { @@ -4075,6 +4902,17 @@ def __init__( filters: Optional["ObjectReplicationPolicyFilter"] = None, **kwargs ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicyFilter + """ super(ObjectReplicationPolicyRule, self).__init__(**kwargs) self.rule_id = rule_id self.source_container = source_container @@ -4085,14 +4923,14 @@ def __init__( class Operation(msrest.serialization.Model): """Storage REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.storage.v2021_06_01.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.storage.v2021_06_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2021_06_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2021_06_01.models.ServiceSpecification """ _attribute_map = { @@ -4111,6 +4949,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2021_06_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2021_06_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -4121,14 +4969,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft Storage. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -4147,6 +4995,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -4157,8 +5015,8 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.Operation] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.Operation] """ _attribute_map = { @@ -4171,6 +5029,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2021_06_01.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value @@ -4196,6 +5058,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -4213,11 +5077,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.storage.v2021_06_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -4248,6 +5112,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2021_06_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -4257,8 +5129,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection] """ _attribute_map = { @@ -4271,6 +5143,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -4292,8 +5168,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -4319,6 +5195,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -4328,8 +5208,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateLinkResource] """ _attribute_map = { @@ -4342,6 +5222,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2021_06_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -4349,15 +5233,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or + :vartype status: str or ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param action_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -4374,6 +5258,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -4385,10 +5280,10 @@ class ProtectedAppendWritesHistory(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param allow_protected_append_writes_all: When enabled, new blocks can be written to both + :ivar allow_protected_append_writes_all: When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. - :type allow_protected_append_writes_all: bool + :vartype allow_protected_append_writes_all: bool :ivar timestamp: Returns the date and time the tag was added. :vartype timestamp: ~datetime.datetime """ @@ -4408,6 +5303,12 @@ def __init__( allow_protected_append_writes_all: Optional[bool] = None, **kwargs ): + """ + :keyword allow_protected_append_writes_all: When enabled, new blocks can be written to both + 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks + can be added and any existing blocks cannot be modified or deleted. + :paramtype allow_protected_append_writes_all: bool + """ super(ProtectedAppendWritesHistory, self).__init__(**kwargs) self.allow_protected_append_writes_all = allow_protected_append_writes_all self.timestamp = None @@ -4416,8 +5317,8 @@ def __init__( class ProtocolSettings(msrest.serialization.Model): """Protocol settings for file service. - :param smb: Setting for SMB protocol. - :type smb: ~azure.mgmt.storage.v2021_06_01.models.SmbSetting + :ivar smb: Setting for SMB protocol. + :vartype smb: ~azure.mgmt.storage.v2021_06_01.models.SmbSetting """ _attribute_map = { @@ -4430,6 +5331,10 @@ def __init__( smb: Optional["SmbSetting"] = None, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_06_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = smb @@ -4447,10 +5352,10 @@ class QueueServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules """ _validation = { @@ -4472,6 +5377,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + """ super(QueueServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -4479,10 +5390,10 @@ def __init__( class ResourceAccessRule(msrest.serialization.Model): """Resource Access Rule. - :param tenant_id: Tenant Id. - :type tenant_id: str - :param resource_id: Resource Id. - :type resource_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar resource_id: Resource Id. + :vartype resource_id: str """ _attribute_map = { @@ -4497,6 +5408,12 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ super(ResourceAccessRule, self).__init__(**kwargs) self.tenant_id = tenant_id self.resource_id = resource_id @@ -4509,11 +5426,11 @@ class RestorePolicyProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Blob restore is enabled if set to true. - :type enabled: bool - :param days: how long this blob can be restored. It should be great than zero and less than + :ivar enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - :type days: int + :vartype days: int :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. :vartype last_enabled_time: ~datetime.datetime :ivar min_restore_time: Returns the minimum date and time that the restore can be started. @@ -4541,6 +5458,13 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -4558,11 +5482,11 @@ class Restriction(msrest.serialization.Model): :ivar values: The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :vartype values: list[str] - :param reason_code: The reason for the restriction. As of now this can be "QuotaId" or + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or ~azure.mgmt.storage.v2021_06_01.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storage.v2021_06_01.models.ReasonCode """ _validation = { @@ -4582,6 +5506,13 @@ def __init__( reason_code: Optional[Union[str, "ReasonCode"]] = None, **kwargs ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2021_06_01.models.ReasonCode + """ super(Restriction, self).__init__(**kwargs) self.type = None self.values = None @@ -4591,15 +5522,15 @@ def __init__( class RoutingPreference(msrest.serialization.Model): """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. - :param routing_choice: Routing Choice defines the kind of network routing opted by the user. + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. Possible values include: "MicrosoftRouting", "InternetRouting". - :type routing_choice: str or ~azure.mgmt.storage.v2021_06_01.models.RoutingChoice - :param publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + :vartype routing_choice: str or ~azure.mgmt.storage.v2021_06_01.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing storage endpoints are to be published. - :type publish_microsoft_endpoints: bool - :param publish_internet_endpoints: A boolean flag which indicates whether internet routing + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing storage endpoints are to be published. - :type publish_internet_endpoints: bool + :vartype publish_internet_endpoints: bool """ _attribute_map = { @@ -4616,6 +5547,17 @@ def __init__( publish_internet_endpoints: Optional[bool] = None, **kwargs ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2021_06_01.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ super(RoutingPreference, self).__init__(**kwargs) self.routing_choice = routing_choice self.publish_microsoft_endpoints = publish_microsoft_endpoints @@ -4627,11 +5569,11 @@ class SasPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. - :type sas_expiration_period: str - :param expiration_action: Required. The SAS expiration action. Can only be Log. Possible values + :ivar sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :vartype sas_expiration_period: str + :ivar expiration_action: Required. The SAS expiration action. Can only be Log. Possible values include: "Log". Default value: "Log". - :type expiration_action: str or ~azure.mgmt.storage.v2021_06_01.models.ExpirationAction + :vartype expiration_action: str or ~azure.mgmt.storage.v2021_06_01.models.ExpirationAction """ _validation = { @@ -4651,6 +5593,13 @@ def __init__( expiration_action: Union[str, "ExpirationAction"] = "Log", **kwargs ): + """ + :keyword sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :paramtype sas_expiration_period: str + :keyword expiration_action: Required. The SAS expiration action. Can only be Log. Possible + values include: "Log". Default value: "Log". + :paramtype expiration_action: str or ~azure.mgmt.storage.v2021_06_01.models.ExpirationAction + """ super(SasPolicy, self).__init__(**kwargs) self.sas_expiration_period = sas_expiration_period self.expiration_action = expiration_action @@ -4661,49 +5610,48 @@ class ServiceSasParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param canonicalized_resource: Required. The canonical path to the signed resource. - :type canonicalized_resource: str - :param resource: The signed services accessible with the service SAS. Possible values include: + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". - :type resource: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResource - :param permissions: The signed permissions for the service SAS. Possible values include: Read + :vartype resource: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". - :type permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions - :param ip_address_or_range: An IP address or a range of IP addresses from which to accept + :vartype permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept requests. - :type ip_address_or_range: str - :param protocols: The protocol permitted for a request made with the account SAS. Possible + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible values include: "https,http", "https". - :type protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol - :param shared_access_start_time: The time at which the SAS becomes valid. - :type shared_access_start_time: ~datetime.datetime - :param shared_access_expiry_time: The time at which the shared access signature becomes - invalid. - :type shared_access_expiry_time: ~datetime.datetime - :param identifier: A unique value up to 64 characters in length that correlates to an access + :vartype protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - :type identifier: str - :param partition_key_start: The start of partition key. - :type partition_key_start: str - :param partition_key_end: The end of partition key. - :type partition_key_end: str - :param row_key_start: The start of row key. - :type row_key_start: str - :param row_key_end: The end of row key. - :type row_key_end: str - :param key_to_sign: The key to sign the account SAS token with. - :type key_to_sign: str - :param cache_control: The response header override for cache control. - :type cache_control: str - :param content_disposition: The response header override for content disposition. - :type content_disposition: str - :param content_encoding: The response header override for content encoding. - :type content_encoding: str - :param content_language: The response header override for content language. - :type content_language: str - :param content_type: The response header override for content type. - :type content_type: str + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str """ _validation = { @@ -4755,6 +5703,52 @@ def __init__( content_type: Optional[str] = None, **kwargs ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2021_06_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_06_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_06_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ super(ServiceSasParameters, self).__init__(**kwargs) self.canonicalized_resource = canonicalized_resource self.resource = resource @@ -4779,8 +5773,9 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.storage.v2021_06_01.models.MetricSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2021_06_01.models.MetricSpecification] """ _attribute_map = { @@ -4793,6 +5788,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2021_06_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4800,10 +5800,10 @@ def __init__( class SignedIdentifier(msrest.serialization.Model): """SignedIdentifier. - :param id: An unique identifier of the stored access policy. - :type id: str - :param access_policy: Access policy. - :type access_policy: ~azure.mgmt.storage.v2021_06_01.models.AccessPolicy + :ivar id: An unique identifier of the stored access policy. + :vartype id: str + :ivar access_policy: Access policy. + :vartype access_policy: ~azure.mgmt.storage.v2021_06_01.models.AccessPolicy """ _attribute_map = { @@ -4818,6 +5818,12 @@ def __init__( access_policy: Optional["AccessPolicy"] = None, **kwargs ): + """ + :keyword id: An unique identifier of the stored access policy. + :paramtype id: str + :keyword access_policy: Access policy. + :paramtype access_policy: ~azure.mgmt.storage.v2021_06_01.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = id self.access_policy = access_policy @@ -4830,11 +5836,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_06_01.models.SkuTier @@ -4856,6 +5862,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -4887,6 +5900,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4899,11 +5914,11 @@ class SkuInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Required for account creation; optional for update. Note + :ivar name: Required. The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS". - :type name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName + :vartype name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", "Premium". :vartype tier: str or ~azure.mgmt.storage.v2021_06_01.models.SkuTier @@ -4918,9 +5933,9 @@ class SkuInformation(msrest.serialization.Model): :ivar capabilities: The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. :vartype capabilities: list[~azure.mgmt.storage.v2021_06_01.models.SKUCapability] - :param restrictions: The restrictions because of which SKU cannot be used. This is empty if + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.storage.v2021_06_01.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storage.v2021_06_01.models.Restriction] """ _validation = { @@ -4949,6 +5964,16 @@ def __init__( restrictions: Optional[List["Restriction"]] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_06_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2021_06_01.models.Restriction] + """ super(SkuInformation, self).__init__(**kwargs) self.name = name self.tier = None @@ -4962,20 +5987,20 @@ def __init__( class SmbSetting(msrest.serialization.Model): """Setting for SMB protocol. - :param multichannel: Multichannel setting. Applies to Premium FileStorage only. - :type multichannel: ~azure.mgmt.storage.v2021_06_01.models.Multichannel - :param versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + :ivar multichannel: Multichannel setting. Applies to Premium FileStorage only. + :vartype multichannel: ~azure.mgmt.storage.v2021_06_01.models.Multichannel + :ivar versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'. - :type versions: str - :param authentication_methods: SMB authentication methods supported by server. Valid values are + :vartype versions: str + :ivar authentication_methods: SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - :type authentication_methods: str - :param kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values + :vartype authentication_methods: str + :ivar kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. - :type kerberos_ticket_encryption: str - :param channel_encryption: SMB channel encryption supported by server. Valid values are + :vartype kerberos_ticket_encryption: str + :ivar channel_encryption: SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - :type channel_encryption: str + :vartype channel_encryption: str """ _attribute_map = { @@ -4996,6 +6021,22 @@ def __init__( channel_encryption: Optional[str] = None, **kwargs ): + """ + :keyword multichannel: Multichannel setting. Applies to Premium FileStorage only. + :paramtype multichannel: ~azure.mgmt.storage.v2021_06_01.models.Multichannel + :keyword versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + SMB3.1.1. Should be passed as a string with delimiter ';'. + :paramtype versions: str + :keyword authentication_methods: SMB authentication methods supported by server. Valid values + are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + :paramtype authentication_methods: str + :keyword kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid + values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. + :paramtype kerberos_ticket_encryption: str + :keyword channel_encryption: SMB channel encryption supported by server. Valid values are + AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + :paramtype channel_encryption: str + """ super(SmbSetting, self).__init__(**kwargs) self.multichannel = multichannel self.versions = versions @@ -5019,10 +6060,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -5047,6 +6088,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -5067,19 +6114,19 @@ class StorageAccount(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar sku: Gets the SKU. :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". :vartype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_06_01.models.Identity - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_06_01.models.Identity + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation :ivar provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_06_01.models.ProvisioningState @@ -5124,62 +6171,63 @@ class StorageAccount(TrackedResource): :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: "Hot", "Cool". :vartype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool :ivar network_rule_set: Network rule set. :vartype network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool :ivar geo_replication_stats: Geo Replication Stats. :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_06_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState :ivar private_endpoint_connections: List of private endpoint connection associated with the specified storage account. :vartype private_endpoint_connections: list[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection] - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference + :vartype routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference :ivar blob_restore_status: Blob restore status. :vartype blob_restore_status: ~azure.mgmt.storage.v2021_06_01.models.BlobRestoreStatus - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - :param default_to_o_auth_authentication: A boolean flag which indicates whether the default + :vartype allow_cross_tenant_replication: bool + :ivar default_to_o_auth_authentication: A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. - :type default_to_o_auth_authentication: bool - :param public_network_access: Allow or disallow public network access to Storage Account. Value + :vartype default_to_o_auth_authentication: bool + :ivar public_network_access: Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess - :param immutable_storage_with_versioning: The property is immutable and can only be set to true + :vartype public_network_access: str or + ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess + :ivar immutable_storage_with_versioning: The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the containers in the account by default. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount """ @@ -5279,6 +6327,62 @@ def __init__( immutable_storage_with_versioning: Optional["ImmutableStorageAccount"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_06_01.models.Identity + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + :keyword default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :paramtype default_to_o_auth_authentication: bool + :keyword public_network_access: Allow or disallow public network access to Storage Account. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess + :keyword immutable_storage_with_versioning: The property is immutable and can only be set to + true at the account creation time. When set to true, it enables object level immutability for + all the containers in the account by default. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount + """ super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) self.sku = None self.kind = None @@ -5326,8 +6430,8 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The storage account name. - :type name: str + :ivar name: Required. The storage account name. + :vartype name: str :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: "Microsoft.Storage/storageAccounts". :vartype type: str @@ -5351,6 +6455,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -5360,87 +6468,88 @@ class StorageAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param sku: Required. Required. Gets or sets the SKU name. - :type sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param kind: Required. Required. Indicates the type of storage account. Possible values - include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :param location: Required. Required. Gets or sets the location of the resource. This will be - one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - :type location: str - :param extended_location: Optional. Set the extended location of the resource. If not set, the + :vartype location: str + :ivar extended_location: Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location. - :type extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_06_01.models.Identity - :param public_network_access: Allow or disallow public network access to Storage Account. Value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_06_01.models.Identity + :ivar public_network_access: Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy - :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. + :vartype public_network_access: str or + ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain - :param encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts + :vartype custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - :type encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - :type enable_https_traffic_only: bool - :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. - :type is_hns_enabled: bool - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :vartype enable_https_traffic_only: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. - :type enable_nfs_v3: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - :param default_to_o_auth_authentication: A boolean flag which indicates whether the default + :vartype allow_cross_tenant_replication: bool + :ivar default_to_o_auth_authentication: A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. - :type default_to_o_auth_authentication: bool - :param immutable_storage_with_versioning: The property is immutable and can only be set to true + :vartype default_to_o_auth_authentication: bool + :ivar immutable_storage_with_versioning: The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the new containers in the account by default. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount """ @@ -5508,6 +6617,91 @@ def __init__( immutable_storage_with_versioning: Optional["ImmutableStorageAccount"] = None, **kwargs ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword extended_location: Optional. Set the extended location of the resource. If not set, + the storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :paramtype extended_location: ~azure.mgmt.storage.v2021_06_01.models.ExtendedLocation + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_06_01.models.Identity + :keyword public_network_access: Allow or disallow public network access to Storage Account. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption is enabled for all storage + accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + :keyword default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :paramtype default_to_o_auth_authentication: bool + :keyword immutable_storage_with_versioning: The property is immutable and can only be set to + true at the account creation time. When set to true, it enables object level immutability for + all the new containers in the account by default. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount + """ super(StorageAccountCreateParameters, self).__init__(**kwargs) self.sku = sku self.kind = kind @@ -5569,6 +6763,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -5610,6 +6806,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -5639,6 +6837,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -5669,6 +6869,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5715,6 +6917,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -5729,9 +6933,9 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The name of storage keys that want to be regenerated, possible - values are key1, key2, kerb1, kerb2. - :type key_name: str + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str """ _validation = { @@ -5748,6 +6952,11 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -5755,76 +6964,76 @@ def __init__( class StorageAccountUpdateParameters(msrest.serialization.Model): """The parameters that can be provided when updating the storage account properties. - :param sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to - Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any - other value. - :type sku: ~azure.mgmt.storage.v2021_06_01.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.storage.v2021_06_01.models.Identity - :param kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_06_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". - :type kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind - :param custom_domain: Custom domain assigned to the storage account by the user. Name is the + :vartype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - :type custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. The default setting is + :vartype custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain + :ivar encryption: Provides the encryption settings on the account. The default setting is unencrypted. - :type encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption - :param sas_policy: SasPolicy assigned to the storage account. - :type sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy - :param key_policy: KeyPolicy assigned to the storage account. - :type key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy - :param access_tier: Required for storage accounts where kind = BlobStorage. The access tier - used for billing. Possible values include: "Hot", "Cool". - :type access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier - :param azure_files_identity_based_authentication: Provides the identity based authentication + :vartype encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication settings for Azure Files. - :type azure_files_identity_based_authentication: + :vartype azure_files_identity_based_authentication: ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication - :param enable_https_traffic_only: Allows https traffic only to storage service if sets to true. - :type enable_https_traffic_only: bool - :param network_rule_set: Network rule set. - :type network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet - :param large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: "Disabled", "Enabled". - :type large_file_shares_state: str or + :vartype large_file_shares_state: str or ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState - :param routing_preference: Maintains information about the network routing choice opted by the + :ivar routing_preference: Maintains information about the network routing choice opted by the user for data transfer. - :type routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference - :param allow_blob_public_access: Allow or disallow public access to all blobs or containers in + :vartype routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - :type allow_blob_public_access: bool - :param minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", "TLS1_1", "TLS1_2". - :type minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion - :param allow_shared_key_access: Indicates whether the storage account permits requests to be + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - :type allow_shared_key_access: bool - :param allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + :vartype allow_shared_key_access: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - :type allow_cross_tenant_replication: bool - :param default_to_o_auth_authentication: A boolean flag which indicates whether the default + :vartype allow_cross_tenant_replication: bool + :ivar default_to_o_auth_authentication: A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. - :type default_to_o_auth_authentication: bool - :param public_network_access: Allow or disallow public network access to Storage Account. Value + :vartype default_to_o_auth_authentication: bool + :ivar public_network_access: Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess - :param immutable_storage_with_versioning: The property is immutable and can only be set to true + :vartype public_network_access: str or + ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess + :ivar immutable_storage_with_versioning: The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the containers in the account by default. - :type immutable_storage_with_versioning: + :vartype immutable_storage_with_versioning: ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount """ @@ -5878,6 +7087,81 @@ def __init__( immutable_storage_with_versioning: Optional["ImmutableStorageAccount"] = None, **kwargs ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2021_06_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_06_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_06_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_06_01.models.CustomDomain + :keyword encryption: Provides the encryption settings on the account. The default setting is + unencrypted. + :paramtype encryption: ~azure.mgmt.storage.v2021_06_01.models.Encryption + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_06_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_06_01.models.KeyPolicy + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_06_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_06_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_06_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_06_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_06_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_06_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + :keyword default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :paramtype default_to_o_auth_authentication: bool + :keyword public_network_access: Allow or disallow public network access to Storage Account. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.storage.v2021_06_01.models.PublicNetworkAccess + :keyword immutable_storage_with_versioning: The property is immutable and can only be set to + true at the account creation time. When set to true, it enables object level immutability for + all the containers in the account by default. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_06_01.models.ImmutableStorageAccount + """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.sku = sku self.tags = tags @@ -5915,8 +7199,8 @@ class StorageQueue(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param metadata: A name-value pair that represents queue metadata. - :type metadata: dict[str, str] + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] :ivar approximate_message_count: Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. @@ -5944,6 +7228,10 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = metadata self.approximate_message_count = None @@ -5970,6 +7258,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5977,20 +7267,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.storage.v2021_06_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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.storage.v2021_06_01.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". - :type last_modified_by_type: str or ~azure.mgmt.storage.v2021_06_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.storage.v2021_06_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -6013,6 +7303,22 @@ def __init__( 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.storage.v2021_06_01.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.storage.v2021_06_01.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 @@ -6057,6 +7363,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -6074,10 +7382,10 @@ class TableServiceProperties(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - :type cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + :vartype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules """ _validation = { @@ -6099,6 +7407,12 @@ def __init__( cors: Optional["CorsRules"] = None, **kwargs ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2021_06_01.models.CorsRules + """ super(TableServiceProperties, self).__init__(**kwargs) self.cors = cors @@ -6108,14 +7422,14 @@ class TagFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. This is the filter tag name, it can have 1 - 128 characters. - :type name: str - :param op: Required. This is the comparison operator which is used for object comparison and + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported. - :type op: str - :param value: Required. This is the filter tag value field used for tag based filtering, it can + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters. - :type value: str + :vartype value: str """ _validation = { @@ -6138,6 +7452,16 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ super(TagFilter, self).__init__(**kwargs) self.name = name self.op = op @@ -6181,6 +7505,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -6209,19 +7535,19 @@ class UpdateHistoryProperty(msrest.serialization.Model): :vartype tenant_id: str :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. :vartype upn: str - :param allow_protected_append_writes: This property can only be changed for unlocked time-based + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. - :type allow_protected_append_writes: bool - :param allow_protected_append_writes_all: This property can only be changed for unlocked + :vartype allow_protected_append_writes: bool + :ivar allow_protected_append_writes_all: This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive. - :type allow_protected_append_writes_all: bool + :vartype allow_protected_append_writes_all: bool """ _validation = { @@ -6251,6 +7577,21 @@ def __init__( allow_protected_append_writes_all: Optional[bool] = None, **kwargs ): + """ + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + :keyword allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :paramtype allow_protected_append_writes_all: bool + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -6296,6 +7637,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -6306,8 +7649,8 @@ def __init__( class UsageListResult(msrest.serialization.Model): """The response from the List Usages operation. - :param value: Gets or sets the list of Storage Resource Usages. - :type value: list[~azure.mgmt.storage.v2021_06_01.models.Usage] + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2021_06_01.models.Usage] """ _attribute_map = { @@ -6320,6 +7663,10 @@ def __init__( value: Optional[List["Usage"]] = None, **kwargs ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2021_06_01.models.Usage] + """ super(UsageListResult, self).__init__(**kwargs) self.value = value @@ -6349,6 +7696,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -6379,6 +7728,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -6389,15 +7740,15 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - :param action: The action of virtual network rule. The only acceptable values to pass in are + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are None and "Allow". The default value is None. - :type action: str - :param state: Gets the state of virtual network rule. Possible values include: "Provisioning", + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "Provisioning", "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". - :type state: str or ~azure.mgmt.storage.v2021_06_01.models.State + :vartype state: str or ~azure.mgmt.storage.v2021_06_01.models.State """ _validation = { @@ -6418,6 +7769,17 @@ def __init__( state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "Provisioning", "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2021_06_01.models.State + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.virtual_network_resource_id = virtual_network_resource_id self.action = action diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py index fc867e84f062..c7bf893a88f0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Required for storage accounts where kind = BlobStorage. The access tier used for billing. """ HOT = "Hot" COOL = "Cool" -class AccountImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state defines the mode of the policy. Disabled state disables the policy, Unlocked state allows increase and decrease of immutability retention time and also allows toggling allowProtectedAppendWrites property, Locked state only allows the increase of @@ -46,7 +31,7 @@ class AccountImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, st LOCKED = "Locked" DISABLED = "Disabled" -class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status indicating whether the primary location of the storage account is available or unavailable. """ @@ -54,11 +39,11 @@ class AccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" UNAVAILABLE = "unavailable" -class BlobInventoryPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. @@ -68,7 +53,7 @@ class BlobRestoreProgressStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En COMPLETE = "Complete" FAILED = "Failed" -class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. @@ -79,7 +64,7 @@ class Bypass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METRICS = "Metrics" AZURE_SERVICES = "AzureServices" -class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETE = "DELETE" GET = "GET" @@ -89,7 +74,7 @@ class CorsRuleAllowedMethodsItem(with_metaclass(_CaseInsensitiveEnumMeta, str, E OPTIONS = "OPTIONS" PUT = "PUT" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -98,14 +83,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class DefaultSharePermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultSharePermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Default share permission for users using Kerberos authentication if RBAC role is not assigned. """ @@ -114,7 +99,7 @@ class DefaultSharePermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) STORAGE_FILE_DATA_SMB_SHARE_CONTRIBUTOR = "StorageFileDataSmbShareContributor" STORAGE_FILE_DATA_SMB_SHARE_ELEVATED_CONTRIBUTOR = "StorageFileDataSmbShareElevatedContributor" -class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the directory service used. """ @@ -122,7 +107,7 @@ class DirectoryServiceOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum AADDS = "AADDS" AD = "AD" -class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication protocol that is used for the file share. Can only be specified when creating a share. """ @@ -130,7 +115,7 @@ class EnabledProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SMB = "SMB" NFS = "NFS" -class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. """ @@ -138,33 +123,33 @@ class EncryptionScopeSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class EncryptionScopeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class ExpirationAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExpirationAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SAS expiration action. Can only be Log. """ LOG = "Log" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is a required field, it specifies the format for the inventory files. """ CSV = "Csv" PARQUET = "Parquet" -class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when @@ -176,14 +161,14 @@ class GeoReplicationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BOOTSTRAP = "Bootstrap" UNAVAILABLE = "Unavailable" -class HttpProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol permitted for a request made with the account SAS. """ HTTPS_HTTP = "https,http" HTTPS = "https" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -192,14 +177,14 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class ImmutabilityPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. """ @@ -208,20 +193,20 @@ class ImmutabilityPolicyUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, LOCK = "lock" EXTEND = "extend" -class InventoryRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Inventory """ INVENTORY = "Inventory" -class KeyPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Permissions for the key -- read-only or full permissions. """ READ = "Read" FULL = "Full" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault """ @@ -229,7 +214,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_STORAGE = "Microsoft.Storage" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. @@ -238,7 +223,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE = "Service" ACCOUNT = "Account" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of storage account. """ @@ -248,14 +233,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class LargeFileSharesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -265,7 +250,7 @@ class LeaseContainerRequestAction(with_metaclass(_CaseInsensitiveEnumMeta, str, RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. """ @@ -273,7 +258,7 @@ class LeaseDuration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "Infinite" FIXED = "Fixed" -class LeaseShareAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseShareAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the lease action. Can be one of the available actions. """ @@ -283,7 +268,7 @@ class LeaseShareAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RELEASE = "Release" BREAK_ENUM = "Break" -class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the container. """ @@ -293,22 +278,22 @@ class LeaseState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "Breaking" BROKEN = "Broken" -class LeaseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The lease status of the container. """ LOCKED = "Locked" UNLOCKED = "Unlocked" -class ListContainersInclude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "deleted" -class ManagementPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class MigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MigrationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property denotes the container level immutability to object level immutability migration state. """ @@ -316,7 +301,7 @@ class MigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IN_PROGRESS = "InProgress" COMPLETED = "Completed" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. """ @@ -325,13 +310,13 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS1_1 = "TLS1_1" TLS1_2 = "TLS1_2" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only """ ACCESS_TIME_TRACKING = "AccessTimeTracking" -class ObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ObjectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is a required field. This field specifies the scope of the inventory created either at the blob or container level. """ @@ -339,7 +324,7 @@ class ObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" CONTAINER = "Container" -class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). """ @@ -353,7 +338,7 @@ class Permissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): U = "u" P = "p" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -362,7 +347,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -370,7 +355,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the storage account at the time the operation was called. """ @@ -378,7 +363,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" -class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether data in the container may be accessed publicly and the level of access. """ @@ -386,7 +371,7 @@ class PublicAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BLOB = "Blob" NONE = "None" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. """ @@ -394,7 +379,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -402,7 +387,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to @@ -412,7 +397,7 @@ class ReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The property is for NFS share only. The default is NoRootSquash. """ @@ -420,27 +405,27 @@ class RootSquashType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class RoutingChoice(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Routing Choice defines the kind of network routing opted by the user. """ MICROSOFT_ROUTING = "MicrosoftRouting" INTERNET_ROUTING = "InternetRouting" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The valid value is Lifecycle """ LIFECYCLE = "Lifecycle" -class Schedule(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Schedule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This is a required field. This field is used to schedule an inventory formation. """ DAILY = "Daily" WEEKLY = "Weekly" -class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). """ @@ -450,7 +435,7 @@ class Services(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): T = "t" F = "f" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. """ @@ -460,7 +445,7 @@ class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" PREMIUM = "Premium" -class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). """ @@ -470,7 +455,7 @@ class SignedResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): F = "f" S = "s" -class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. @@ -480,7 +465,7 @@ class SignedResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): C = "c" O = "o" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. """ @@ -494,14 +479,14 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_GZRS = "Standard_GZRS" STANDARD_RAGZRS = "Standard_RAGZRS" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" PREMIUM = "Premium" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the state of virtual network rule. """ @@ -511,12 +496,12 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" NETWORK_SOURCE_DELETED = "NetworkSourceDeleted" -class StorageAccountExpand(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO_REPLICATION_STATS = "geoReplicationStats" BLOB_RESTORE_STATUS = "blobRestoreStatus" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the unit of measurement. """ diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py index c992b0cbd435..f16c3dc94210 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py @@ -5,25 +5,632 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_object_level_worm_request_initial( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 + ) class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -47,16 +654,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - include=None, # type: Optional[Union[str, "_models.ListContainersInclude"]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListContainerItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: """Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. @@ -85,42 +692,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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('ListContainerItems', pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,20 +742,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. @@ -180,33 +785,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -224,17 +819,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - blob_container, # type: "_models.BlobContainer" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": """Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @@ -262,33 +859,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(blob_container, 'BlobContainer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blob_container, 'BlobContainer') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,16 +889,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobContainer" + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": """Gets properties of a specified container. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -336,28 +925,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -371,16 +950,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -405,26 +986,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,15 +1010,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + @distributed_trace def set_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @@ -474,33 +1048,23 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,17 +1078,19 @@ def set_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + @distributed_trace def clear_legal_hold( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - legal_hold, # type: "_models.LegalHold" - **kwargs # type: Any - ): - # type: (...) -> "_models.LegalHold" + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @@ -552,33 +1118,23 @@ def clear_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.clear_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(legal_hold, 'LegalHold') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -592,18 +1148,20 @@ def clear_legal_hold( return cls(pipeline_response, deserialized, {}) return deserialized + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + @distributed_trace def create_or_update_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. @@ -636,40 +1194,27 @@ def create_or_update_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -679,23 +1224,26 @@ def create_or_update_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def get_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Gets the existing immutability policy along with the corresponding ETag in response headers and body. @@ -725,32 +1273,19 @@ def get_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -760,23 +1295,26 @@ def get_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def delete_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the @@ -808,31 +1346,19 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - immutability_policy_name = "default" - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'immutabilityPolicyName': self._serialize.url("immutability_policy_name", immutability_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -842,23 +1368,26 @@ def delete_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + @distributed_trace def lock_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @@ -888,29 +1417,19 @@ def lock_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.lock_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -920,24 +1439,27 @@ def lock_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + @distributed_trace def extend_immutability_policy( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - if_match, # type: str - parameters=None, # type: Optional["_models.ImmutabilityPolicy"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ImmutabilityPolicy" + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @@ -971,37 +1493,27 @@ def extend_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.extend_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ImmutabilityPolicy') + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1011,23 +1523,26 @@ def extend_immutability_policy( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - parameters=None, # type: Optional["_models.LeaseContainerRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseContainerResponse" + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": """The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -1055,36 +1570,26 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseContainerRequest') + _json = self._serialize.body(parameters, 'LeaseContainerRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1098,43 +1603,34 @@ def lease( return cls(pipeline_response, deserialized, {}) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + def _object_level_worm_initial( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + container_name: str, + **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', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._object_level_worm_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_object_level_worm_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self._object_level_worm_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1147,14 +1643,15 @@ def _object_level_worm_initial( _object_level_worm_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore + + @distributed_trace def begin_object_level_worm( self, - resource_group_name, # type: str - account_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold @@ -1174,15 +1671,17 @@ def begin_object_level_worm( :type container_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -1197,22 +1696,14 @@ def begin_object_level_worm( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'containerName': self._serialize.url("container_name", container_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1224,4 +1715,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_object_level_worm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py index a4a20167ddfc..8a6e99de0948 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +222,8 @@ def get( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobInventoryPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy @@ -75,34 +234,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -111,17 +260,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - properties, # type: "_models.BlobInventoryPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobInventoryPolicy" + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": """Sets the blob inventory policy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -133,7 +284,8 @@ def create_or_update( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName :param properties: The blob inventory policy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -146,39 +298,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'BlobInventoryPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) @@ -187,16 +329,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: """Deletes the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -208,7 +352,8 @@ def delete( :type account_name: str :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It should always be 'default'. - :type blob_inventory_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicyName :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 @@ -219,34 +364,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'blobInventoryPolicyName': self._serialize.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -254,13 +389,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListBlobInventoryPolicy"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: """Gets the blob inventory policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -271,8 +407,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListBlobInventoryPolicy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListBlobInventoryPolicy] + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.ListBlobInventoryPolicy] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] @@ -280,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListBlobInventoryPolicy', pipeline_response) + deserialized = self._deserialize("ListBlobInventoryPolicy", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -322,12 +457,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py index 9169cd28d4a6..c2a029a73f78 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py @@ -5,23 +5,144 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,13 +166,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BlobServiceItems"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: """List blob services of storage account. It returns a collection of one object named default. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -71,36 +192,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('BlobServiceItems', pipeline_response) + deserialized = self._deserialize("BlobServiceItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +236,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -154,34 +273,22 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobServiceProperties') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,15 +302,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": """Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -224,29 +333,17 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'BlobServicesName': self._serialize.url("blob_services_name", blob_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +357,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py index 24e0c28d0422..029c9f3ed70c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py @@ -5,23 +5,91 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + deleted_account_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}') + path_format_arguments = { + "deletedAccountName": _SERIALIZER.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,16 +113,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedAccountListResult"]: """Lists deleted accounts under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.DeletedAccountListResult] + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.DeletedAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] @@ -62,34 +132,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('DeletedAccountListResult', pipeline_response) + deserialized = self._deserialize("DeletedAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,24 +167,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + @distributed_trace def get( self, - deleted_account_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedAccount" + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": """Get properties of specified deleted account resource. :param deleted_account_name: Name of the deleted storage account. @@ -136,33 +202,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deletedAccountName': self._serialize.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedAccount', pipeline_response) @@ -171,4 +227,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py index ffa54c69dd19..cf406394332b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py @@ -5,23 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,15 +212,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. @@ -82,39 +249,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -127,17 +284,19 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def patch( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - encryption_scope, # type: "_models.EncryptionScope" - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": """Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. @@ -165,39 +324,29 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(encryption_scope, 'EncryptionScope') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -206,16 +355,18 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - encryption_scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionScope" + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": """Returns the properties for the specified encryption scope. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -240,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'encryptionScopeName': self._serialize.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionScope', pipeline_response) @@ -276,15 +417,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionScopeListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: """Lists all the encryption scopes available under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -295,8 +438,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeListResult] + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.EncryptionScopeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] @@ -304,36 +449,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('EncryptionScopeListResult', pipeline_response) + deserialized = self._deserialize("EncryptionScopeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -351,6 +493,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py index 0ebb435eb31f..5964741f8bb8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): """FileServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceItems" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": """List all file services in storage accounts. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,33 +191,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceItems', pipeline_response) @@ -105,16 +216,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.FileServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -138,40 +251,28 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - file_services_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'FileServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -180,15 +281,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FileServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -209,35 +312,23 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - file_services_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'FileServicesName': self._serialize.url("file_services_name", file_services_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileServiceProperties', pipeline_response) @@ -246,4 +337,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py index ee6d098cdab5..55796ddcd1d8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py @@ -5,23 +5,349 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + 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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_lease_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, '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 FileSharesOperations(object): """FileSharesOperations operations. @@ -45,16 +371,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FileShareItems"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: """Lists all shares. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -83,42 +409,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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('FileShareItems', pipeline_response) + deserialized = self._deserialize("FileShareItems", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,27 +454,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -183,41 +507,30 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -230,17 +543,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - file_share, # type: "_models.FileShare" - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. @@ -268,39 +583,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(file_share, 'FileShare') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -309,18 +614,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - expand=None, # type: Optional[str] - x_ms_snapshot=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.FileShare" + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -350,38 +657,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FileShare', pipeline_response) @@ -390,18 +685,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - include=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any + ) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -435,38 +732,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if include is not None: - query_parameters['$include'] = self._serialize.query("include", include, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + include=include, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -474,15 +759,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + @distributed_trace def restore( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - deleted_share, # type: "_models.DeletedShare" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: """Restore a file share within a valid retention days if share soft delete is enabled. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -509,39 +795,29 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deleted_share, 'DeletedShare') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -549,16 +825,17 @@ def restore( restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + + @distributed_trace def lease( self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - x_ms_snapshot=None, # type: Optional[str] - parameters=None, # type: Optional["_models.LeaseShareRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.LeaseShareResponse" + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + parameters: Optional["_models.LeaseShareRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseShareResponse": """The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. @@ -588,52 +865,44 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if x_ms_snapshot is not None: - header_parameters['x-ms-snapshot'] = self._serialize.header("x_ms_snapshot", x_ms_snapshot, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'LeaseShareRequest') + _json = self._serialize.body(parameters, 'LeaseShareRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + x_ms_snapshot=x_ms_snapshot, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LeaseShareResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py index d6a65327a004..c65577caeb41 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py @@ -5,22 +5,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,14 +161,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": """Gets the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -63,7 +180,8 @@ def get( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagementPolicy, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy @@ -74,28 +192,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,17 +217,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - properties, # type: "_models.ManagementPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagementPolicy" + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": """Sets the managementpolicy to the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -131,7 +241,8 @@ def create_or_update( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName :param properties: The ManagementPolicy set to a storage account. :type properties: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,33 +255,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ManagementPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -184,16 +285,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: """Deletes the managementpolicy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -205,7 +308,8 @@ def delete( :type account_name: str :param management_policy_name: The name of the Storage Account Management Policy. It should always be 'default'. - :type management_policy_name: str or ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicyName :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 @@ -216,26 +320,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'managementPolicyName': self._serialize.url("management_policy_name", management_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,3 +343,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py index 8483558c732b..42e6a669abc9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ObjectReplicationPolicies"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: """List the object replication policies associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectReplicationPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicies] + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ObjectReplicationPolicies', pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Get the object replication policy of the storage account by policy ID. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -156,34 +314,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -192,17 +340,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - properties, # type: "_models.ObjectReplicationPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ObjectReplicationPolicy" + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": """Create or update the object replication policy of the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -230,39 +380,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'ObjectReplicationPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) @@ -271,16 +411,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - object_replication_policy_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: """Deletes the object replication policy associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -305,37 +447,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py index 87ce91d6dabf..9e6aa0fb98b3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Storage 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.storage.v2021_06_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + 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) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py index 5ace766fd21c..a377f6f1db2b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,8 +220,10 @@ def list( lower-case letters only. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,17 +337,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -224,39 +374,29 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -265,16 +405,18 @@ def put( return cls(pipeline_response, deserialized, {}) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Deletes the specified private endpoint connection associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -297,37 +439,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py index e168aa3b06a2..346a15ac4494 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,27 +107,17 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +131,6 @@ def list_by_storage_account( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py index 3af976e8c8a6..78bffb87257a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): """QueueOperations operations. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -80,39 +291,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -121,17 +322,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - queue, # type: "_models.StorageQueue" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": """Creates a new queue with the specified queue name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -158,39 +361,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(queue, 'StorageQueue') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue, 'StorageQueue') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -199,16 +392,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageQueue" + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": """Gets the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -233,34 +428,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('StorageQueue', pipeline_response) @@ -269,16 +454,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - queue_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -303,34 +490,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,15 +515,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxpagesize=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListQueueResource"] + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: """Gets a list of all the queues under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -372,40 +550,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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('ListQueueResource', pipeline_response) + deserialized = self._deserialize("ListQueueResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -418,12 +593,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py index 779f6d26cbaf..9d40d5eecd71 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListQueueServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": """List all queue services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,33 +191,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListQueueServices', pipeline_response) @@ -105,16 +216,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.QueueServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -138,40 +251,28 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - queue_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueueServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -180,15 +281,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QueueServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": """Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -209,35 +312,23 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - queue_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'queueServiceName': self._serialize.url("queue_service_name", queue_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueueServiceProperties', pipeline_response) @@ -246,4 +337,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py index eebde5adeaa6..48e515451231 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageSkuListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageSkuListResult"]: """Lists the available SKUs supported by Microsoft.Storage for given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSkuListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageSkuListResult] + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] @@ -62,34 +97,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageSkuListResult', pipeline_response) + deserialized = self._deserialize("StorageSkuListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +137,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py index a8a7e3f6f67b..b45cb5fb1a01 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py @@ -5,25 +5,634 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_hierarchical_namespace_migration_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + request_type: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_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['requestType'] = _SERIALIZER.query("request_type", request_type, '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_abort_hierarchical_namespace_migration_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,18 +656,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - account_name, # type: "_models.StorageAccountCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the storage account name is valid and is not already in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountCheckNameAvailabilityParameters + :type account_name: + ~azure.mgmt.storage.v2021_06_01.models.StorageAccountCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.CheckNameAvailabilityResult @@ -69,30 +679,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,47 +706,38 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,16 +753,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or @@ -188,15 +781,19 @@ def begin_create( :type parameters: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountCreateParameters :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. + :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 StorageAccount or the result of cls(response) + :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 StorageAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_06_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,27 +805,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -240,15 +831,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -268,25 +860,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,14 +883,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def get_properties( self, - resource_group_name, # type: str - account_name, # type: str - expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -332,29 +917,18 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,16 +942,18 @@ def get_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.StorageAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": """The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not @@ -406,32 +982,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,19 +1011,23 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -465,34 +1035,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +1075,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -528,8 +1094,10 @@ def list_by_resource_group( name is case insensitive. :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 StorageAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_06_01.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] @@ -537,35 +1105,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + 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('StorageAccountListResult', pipeline_response) + deserialized = self._deserialize("StorageAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -583,19 +1147,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - expand="kerb", # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. @@ -606,7 +1171,8 @@ def list_keys( Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str - :param expand: Specifies type of the key to be listed. Possible value is kerb. + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) @@ -618,29 +1184,18 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -654,16 +1209,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountListKeysResult" + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": """Regenerates one of the access keys or Kerberos keys for the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -675,7 +1232,8 @@ def regenerate_key( :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. - :type regenerate_key: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountRegenerateKeyParameters + :type regenerate_key: + ~azure.mgmt.storage.v2021_06_01.models.StorageAccountRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageAccountListKeysResult, or the result of cls(response) :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountListKeysResult @@ -686,32 +1244,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -725,16 +1273,18 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + @distributed_trace def list_account_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.AccountSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListAccountSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": """List SAS credentials of a storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -756,32 +1306,22 @@ def list_account_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_account_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccountSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,16 +1335,18 @@ def list_account_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + @distributed_trace def list_service_sas( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ServiceSasParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListServiceSasResponse" + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": """List service SAS credentials of a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -826,32 +1368,22 @@ def list_service_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_service_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceSasParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceSasParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -865,39 +1397,32 @@ def list_service_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + def _failover_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._failover_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,13 +1435,14 @@ def _failover_initial( _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + @distributed_trace def begin_failover( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @@ -930,15 +1456,17 @@ def begin_failover( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -952,21 +1480,14 @@ def begin_failover( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -978,64 +1499,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore def _hierarchical_namespace_migration_initial( self, - resource_group_name, # type: str - account_name, # type: str - request_type, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + request_type: str, + **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', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._hierarchical_namespace_migration_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['requestType'] = self._serialize.query("request_type", request_type, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + request_type=request_type, + template_url=self._hierarchical_namespace_migration_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore + + @distributed_trace def begin_hierarchical_namespace_migration( self, - resource_group_name, # type: str - account_name, # type: str - request_type, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + request_type: str, + **kwargs: Any + ) -> LROPoller[None]: """Live Migration of storage account to enable Hns. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1052,15 +1563,17 @@ def begin_hierarchical_namespace_migration( :type request_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 operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -1075,21 +1588,14 @@ def begin_hierarchical_namespace_migration( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1101,61 +1607,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore def _abort_hierarchical_namespace_migration_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **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', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._abort_hierarchical_namespace_migration_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_abort_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._abort_hierarchical_namespace_migration_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _abort_hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore + + @distributed_trace def begin_abort_hierarchical_namespace_migration( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Abort live Migration of storage account to enable Hns. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1167,15 +1663,17 @@ def begin_abort_hierarchical_namespace_migration( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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', @@ -1189,21 +1687,14 @@ def begin_abort_hierarchical_namespace_migration( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1215,47 +1706,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_abort_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore def _restore_blob_ranges_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BlobRestoreStatus" + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_blob_ranges_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BlobRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BlobRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1273,16 +1754,18 @@ def _restore_blob_ranges_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace def begin_restore_blob_ranges( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BlobRestoreParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BlobRestoreStatus"] + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: """Restore blobs in the specified blob ranges. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1296,15 +1779,19 @@ def begin_restore_blob_ranges( :type parameters: ~azure.mgmt.storage.v2021_06_01.models.BlobRestoreParameters :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. + :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 BlobRestoreStatus or the result of cls(response) + :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 BlobRestoreStatus or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_06_01.models.BlobRestoreStatus] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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.BlobRestoreStatus"] lro_delay = kwargs.pop( 'polling_interval', @@ -1316,27 +1803,21 @@ def begin_restore_blob_ranges( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1348,15 +1829,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + @distributed_trace def revoke_user_delegation_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1376,25 +1858,17 @@ def revoke_user_delegation_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.revoke_user_delegation_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1406,3 +1880,4 @@ def revoke_user_delegation_keys( return cls(pipeline_response, None, {}) revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py index 4ecdea47a615..b4a4a5ba0f30 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): """TableOperations operations. @@ -45,14 +230,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -76,34 +261,24 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -112,16 +287,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Creates a new table with the specified table name, under the specified account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -145,34 +322,24 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.patch(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -181,16 +348,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Table" + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": """Gets the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -214,34 +383,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Table', pipeline_response) @@ -250,16 +409,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -283,34 +444,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableName': self._serialize.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -318,13 +469,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListTableResource"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: """Gets a list of all the tables under the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -344,36 +496,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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('ListTableResource', pipeline_response) + deserialized = self._deserialize("ListTableResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -386,12 +535,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py index fd02c93d04b8..655e68cc94af 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py @@ -5,22 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-06-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): """TableServicesOperations operations. @@ -44,13 +165,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListTableServices" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": """List all table services for the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,33 +191,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ListTableServices', pipeline_response) @@ -105,16 +216,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + @distributed_trace def set_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.TableServiceProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": """Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -138,40 +251,28 @@ def set_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - table_service_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TableServiceProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -180,15 +281,17 @@ def set_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + @distributed_trace def get_service_properties( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TableServiceProperties" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": """Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -209,35 +312,23 @@ def get_service_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - table_service_name = "default" - accept = "application/json" - - # Construct URL - url = self.get_service_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'tableServiceName': self._serialize.url("table_service_name", table_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TableServiceProperties', pipeline_response) @@ -246,4 +337,6 @@ def get_service_properties( return cls(pipeline_response, deserialized, {}) return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py index 242d70b8225f..41f7400375df 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): """UsagesOperations operations. @@ -45,12 +80,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Gets the current usage count and the limit for the resources of the location under the subscription. @@ -66,35 +101,31 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +143,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py new file mode 100644 index 000000000000..1072dc103161 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._storage_management_client import StorageManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py new file mode 100644 index 000000000000..208223817180 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 StorageManagementClientConfiguration(Configuration): + """Configuration for StorageManagementClient. + + 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 ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-storage/{}'.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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json new file mode 100644 index 000000000000..692b8bf846e4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json @@ -0,0 +1,121 @@ +{ + "chosen_version": "2021-08-01", + "total_api_version_list": ["2021-08-01"], + "client": { + "name": "StorageManagementClient", + "filename": "_storage_management_client", + "description": "The Azure Storage Management API.", + "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\": [\"StorageManagementClientConfiguration\"]}}, \"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\": [\"StorageManagementClientConfiguration\"]}}, \"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 ID of the target subscription.", + "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 ID of the target subscription.", + "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", + "skus": "SkusOperations", + "storage_accounts": "StorageAccountsOperations", + "deleted_accounts": "DeletedAccountsOperations", + "usages": "UsagesOperations", + "management_policies": "ManagementPoliciesOperations", + "blob_inventory_policies": "BlobInventoryPoliciesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "object_replication_policies": "ObjectReplicationPoliciesOperations", + "local_users": "LocalUsersOperations", + "encryption_scopes": "EncryptionScopesOperations", + "blob_services": "BlobServicesOperations", + "blob_containers": "BlobContainersOperations", + "file_services": "FileServicesOperations", + "file_shares": "FileSharesOperations", + "queue_services": "QueueServicesOperations", + "queue": "QueueOperations", + "table_services": "TableServicesOperations", + "table": "TableOperations" + } +} \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py new file mode 100644 index 000000000000..83125fc3fe19 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py @@ -0,0 +1,156 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, LocalUsersOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class StorageManagementClient: + """The Azure Storage Management API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.storage.v2021_08_01.operations.Operations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.storage.v2021_08_01.operations.SkusOperations + :ivar storage_accounts: StorageAccountsOperations operations + :vartype storage_accounts: azure.mgmt.storage.v2021_08_01.operations.StorageAccountsOperations + :ivar deleted_accounts: DeletedAccountsOperations operations + :vartype deleted_accounts: azure.mgmt.storage.v2021_08_01.operations.DeletedAccountsOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.storage.v2021_08_01.operations.UsagesOperations + :ivar management_policies: ManagementPoliciesOperations operations + :vartype management_policies: + azure.mgmt.storage.v2021_08_01.operations.ManagementPoliciesOperations + :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_08_01.operations.BlobInventoryPoliciesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_08_01.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.storage.v2021_08_01.operations.PrivateLinkResourcesOperations + :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_08_01.operations.ObjectReplicationPoliciesOperations + :ivar local_users: LocalUsersOperations operations + :vartype local_users: azure.mgmt.storage.v2021_08_01.operations.LocalUsersOperations + :ivar encryption_scopes: EncryptionScopesOperations operations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_08_01.operations.EncryptionScopesOperations + :ivar blob_services: BlobServicesOperations operations + :vartype blob_services: azure.mgmt.storage.v2021_08_01.operations.BlobServicesOperations + :ivar blob_containers: BlobContainersOperations operations + :vartype blob_containers: azure.mgmt.storage.v2021_08_01.operations.BlobContainersOperations + :ivar file_services: FileServicesOperations operations + :vartype file_services: azure.mgmt.storage.v2021_08_01.operations.FileServicesOperations + :ivar file_shares: FileSharesOperations operations + :vartype file_shares: azure.mgmt.storage.v2021_08_01.operations.FileSharesOperations + :ivar queue_services: QueueServicesOperations operations + :vartype queue_services: azure.mgmt.storage.v2021_08_01.operations.QueueServicesOperations + :ivar queue: QueueOperations operations + :vartype queue: azure.mgmt.storage.v2021_08_01.operations.QueueOperations + :ivar table_services: TableServicesOperations operations + :vartype table_services: azure.mgmt.storage.v2021_08_01.operations.TableServicesOperations + :ivar table: TableOperations operations + :vartype table: azure.mgmt.storage.v2021_08_01.operations.TableOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :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 = StorageManagementClientConfiguration(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.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.local_users = LocalUsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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: () -> StorageManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py new file mode 100644 index 000000000000..3b85e3279ea7 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._storage_management_client import StorageManagementClient +__all__ = ['StorageManagementClient'] + +# `._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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py new file mode 100644 index 000000000000..b9ef2874d493 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class StorageManagementClientConfiguration(Configuration): + """Configuration for StorageManagementClient. + + 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 ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(StorageManagementClientConfiguration, 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-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-storage/{}'.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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_patch.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_patch.py @@ -0,0 +1,31 @@ +# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py new file mode 100644 index 000000000000..e2ecd0cc2d91 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py @@ -0,0 +1,156 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 StorageManagementClientConfiguration +from .operations import BlobContainersOperations, BlobInventoryPoliciesOperations, BlobServicesOperations, DeletedAccountsOperations, EncryptionScopesOperations, FileServicesOperations, FileSharesOperations, LocalUsersOperations, ManagementPoliciesOperations, ObjectReplicationPoliciesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueueOperations, QueueServicesOperations, SkusOperations, StorageAccountsOperations, TableOperations, TableServicesOperations, UsagesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class StorageManagementClient: + """The Azure Storage Management API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.storage.v2021_08_01.aio.operations.Operations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.storage.v2021_08_01.aio.operations.SkusOperations + :ivar storage_accounts: StorageAccountsOperations operations + :vartype storage_accounts: + azure.mgmt.storage.v2021_08_01.aio.operations.StorageAccountsOperations + :ivar deleted_accounts: DeletedAccountsOperations operations + :vartype deleted_accounts: + azure.mgmt.storage.v2021_08_01.aio.operations.DeletedAccountsOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.storage.v2021_08_01.aio.operations.UsagesOperations + :ivar management_policies: ManagementPoliciesOperations operations + :vartype management_policies: + azure.mgmt.storage.v2021_08_01.aio.operations.ManagementPoliciesOperations + :ivar blob_inventory_policies: BlobInventoryPoliciesOperations operations + :vartype blob_inventory_policies: + azure.mgmt.storage.v2021_08_01.aio.operations.BlobInventoryPoliciesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.storage.v2021_08_01.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.storage.v2021_08_01.aio.operations.PrivateLinkResourcesOperations + :ivar object_replication_policies: ObjectReplicationPoliciesOperations operations + :vartype object_replication_policies: + azure.mgmt.storage.v2021_08_01.aio.operations.ObjectReplicationPoliciesOperations + :ivar local_users: LocalUsersOperations operations + :vartype local_users: azure.mgmt.storage.v2021_08_01.aio.operations.LocalUsersOperations + :ivar encryption_scopes: EncryptionScopesOperations operations + :vartype encryption_scopes: + azure.mgmt.storage.v2021_08_01.aio.operations.EncryptionScopesOperations + :ivar blob_services: BlobServicesOperations operations + :vartype blob_services: azure.mgmt.storage.v2021_08_01.aio.operations.BlobServicesOperations + :ivar blob_containers: BlobContainersOperations operations + :vartype blob_containers: + azure.mgmt.storage.v2021_08_01.aio.operations.BlobContainersOperations + :ivar file_services: FileServicesOperations operations + :vartype file_services: azure.mgmt.storage.v2021_08_01.aio.operations.FileServicesOperations + :ivar file_shares: FileSharesOperations operations + :vartype file_shares: azure.mgmt.storage.v2021_08_01.aio.operations.FileSharesOperations + :ivar queue_services: QueueServicesOperations operations + :vartype queue_services: azure.mgmt.storage.v2021_08_01.aio.operations.QueueServicesOperations + :ivar queue: QueueOperations operations + :vartype queue: azure.mgmt.storage.v2021_08_01.aio.operations.QueueOperations + :ivar table_services: TableServicesOperations operations + :vartype table_services: azure.mgmt.storage.v2021_08_01.aio.operations.TableServicesOperations + :ivar table: TableOperations operations + :vartype table: azure.mgmt.storage.v2021_08_01.aio.operations.TableOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :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 = StorageManagementClientConfiguration(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.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_policies = ManagementPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_inventory_policies = BlobInventoryPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.local_users = LocalUsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.encryption_scopes = EncryptionScopesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob_containers = BlobContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue_services = QueueServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.table_services = TableServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.table = TableOperations(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) -> "StorageManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py new file mode 100644 index 000000000000..4c1064ae3825 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._skus_operations import SkusOperations +from ._storage_accounts_operations import StorageAccountsOperations +from ._deleted_accounts_operations import DeletedAccountsOperations +from ._usages_operations import UsagesOperations +from ._management_policies_operations import ManagementPoliciesOperations +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations +from ._local_users_operations import LocalUsersOperations +from ._encryption_scopes_operations import EncryptionScopesOperations +from ._blob_services_operations import BlobServicesOperations +from ._blob_containers_operations import BlobContainersOperations +from ._file_services_operations import FileServicesOperations +from ._file_shares_operations import FileSharesOperations +from ._queue_services_operations import QueueServicesOperations +from ._queue_operations import QueueOperations +from ._table_services_operations import TableServicesOperations +from ._table_operations import TableOperations + +__all__ = [ + 'Operations', + 'SkusOperations', + 'StorageAccountsOperations', + 'DeletedAccountsOperations', + 'UsagesOperations', + 'ManagementPoliciesOperations', + 'BlobInventoryPoliciesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ObjectReplicationPoliciesOperations', + 'LocalUsersOperations', + 'EncryptionScopesOperations', + 'BlobServicesOperations', + 'BlobContainersOperations', + 'FileServicesOperations', + 'FileSharesOperations', + 'QueueServicesOperations', + 'QueueOperations', + 'TableServicesOperations', + 'TableOperations', +] diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py new file mode 100644 index 000000000000..0b592eaecc83 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py @@ -0,0 +1,1114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._blob_containers_operations import build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, build_create_request, build_delete_immutability_policy_request, build_delete_request, build_extend_immutability_policy_request, build_get_immutability_policy_request, build_get_request, build_lease_request, build_list_request, build_lock_immutability_policy_request, build_object_level_worm_request_initial, build_set_legal_hold_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BlobContainersOperations: + """BlobContainersOperations 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.storage.v2021_08_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, + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ListContainerItems"]: + """Lists all containers and does not support a prefix like data plane. Also SRP today does not + return continuation token. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param maxpagesize: Optional. Specified maximum number of containers that can be included in + the list. + :type maxpagesize: str + :param filter: Optional. When specified, only container names starting with the filter will be + listed. + :type filter: str + :param include: Optional, used to include the properties for soft deleted blob containers. + :type include: str or ~azure.mgmt.storage.v2021_08_01.models.ListContainersInclude + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListContainerItems or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListContainerItems] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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("ListContainerItems", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": + """Creates a new container under the specified account as described by request body. The container + resource includes metadata and properties for that container. It does not include a list of the + blobs contained by the container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param blob_container: Properties of the blob container to create. + :type blob_container: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobContainer, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobContainer"] + 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(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('BlobContainer', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BlobContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": + """Updates container properties as specified in request body. Properties not mentioned in the + request will be unchanged. Update fails if the specified container doesn't already exist. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param blob_container: Properties to update for the blob container. + :type blob_container: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobContainer, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobContainer"] + 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(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": + """Gets properties of a specified container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobContainer, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobContainer"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: + """Deletes specified container under its account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace_async + async def set_legal_hold( + self, + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": + """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold + follows an append pattern and does not clear out the existing tags that are not specified in + the request. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param legal_hold: The LegalHold property that will be set to a blob container. + :type legal_hold: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LegalHold, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LegalHold"] + 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(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('LegalHold', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + + @distributed_trace_async + async def clear_legal_hold( + self, + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": + """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent + operation. ClearLegalHold clears out only the specified tags in the request. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param legal_hold: The LegalHold property that will be clear from a blob container. + :type legal_hold: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LegalHold, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LegalHold"] + 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(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('LegalHold', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + + @distributed_trace_async + async def create_or_update_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but + not required for this operation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob + container. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') + else: + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + + @distributed_trace_async + async def get_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Gets the existing immutability policy along with the corresponding ETag in response headers and + body. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + + @distributed_trace_async + async def delete_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Aborts an unlocked immutability policy. The response of delete has + immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this + operation. Deleting a locked immutability policy is not allowed, the only way is to delete the + container after deleting all expired blobs inside the policy locked container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + + @distributed_trace_async + async def lock_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is + ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + + @distributed_trace_async + async def extend_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only + action allowed on a Locked policy will be this action. ETag in If-Match is required for this + operation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob + container. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') + else: + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + + @distributed_trace_async + async def lease( + self, + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": + """The Lease Container operation establishes and manages a lock on a container for delete + operations. The lock duration can be 15 to 60 seconds, or can be infinite. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param parameters: Lease Container request body. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LeaseContainerResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LeaseContainerResponse"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'LeaseContainerRequest') + else: + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('LeaseContainerResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + + + async def _object_level_worm_initial( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **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', {})) + + + request = build_object_level_worm_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self._object_level_worm_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, {}) + + _object_level_worm_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore + + + @distributed_trace_async + async def begin_object_level_worm( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation migrates a blob container from container level WORM to object level immutability + enabled container. Prerequisites require a container level immutability policy either in locked + or unlocked state, Account level versioning must be enabled and there should be no Legal hold + on the container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, 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._object_level_worm_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + 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, lro_options={'final-state-via': 'location'}, **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_object_level_worm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py new file mode 100644 index 000000000000..e4a42e31c1a8 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py @@ -0,0 +1,313 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.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._blob_inventory_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BlobInventoryPoliciesOperations: + """BlobInventoryPoliciesOperations 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.storage.v2021_08_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, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": + """Gets the blob inventory policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It + should always be 'default'. + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobInventoryPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobInventoryPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": + """Sets the blob inventory policy to the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It + should always be 'default'. + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyName + :param properties: The blob inventory policy set to a storage account. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobInventoryPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobInventoryPolicy"] + 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(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: + """Deletes the blob inventory policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It + should always be 'default'. + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyName + :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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ListBlobInventoryPolicy"]: + """Gets the blob inventory policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListBlobInventoryPolicy] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("ListBlobInventoryPolicy", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py new file mode 100644 index 000000000000..7ecab227437f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._blob_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BlobServicesOperations: + """BlobServicesOperations 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.storage.v2021_08_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, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BlobServiceItems"]: + """List blob services of storage account. It returns a collection of one object named default. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BlobServiceItems or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.BlobServiceItems] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("BlobServiceItems", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + + @distributed_trace_async + async def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": + """Sets the properties of a storage account’s Blob service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of a storage account’s Blob service, including properties for + Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceProperties"] + 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(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('BlobServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + + @distributed_trace_async + async def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": + """Gets the properties of a storage account’s Blob service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('BlobServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py new file mode 100644 index 000000000000..875555253183 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py @@ -0,0 +1,165 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._deleted_accounts_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeletedAccountsOperations: + """DeletedAccountsOperations 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.storage.v2021_08_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.DeletedAccountListResult"]: + """Lists deleted accounts under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.DeletedAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] + 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( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_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("DeletedAccountListResult", 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + + @distributed_trace_async + async def get( + self, + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": + """Get properties of specified deleted account resource. + + :param deleted_account_name: Name of the deleted storage account. + :type deleted_account_name: str + :param location: The location of the deleted storage account. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedAccount, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.DeletedAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py new file mode 100644 index 000000000000..e7e94ff541f0 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py @@ -0,0 +1,334 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.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._encryption_scopes_operations import build_get_request, build_list_request, build_patch_request, build_put_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EncryptionScopesOperations: + """EncryptionScopesOperations 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.storage.v2021_08_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 put( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": + """Synchronously creates or updates an encryption scope under the specified storage account. If an + encryption scope is already created and a subsequent request is issued with different + properties, the encryption scope properties will be updated per the specified request. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param encryption_scope_name: The name of the encryption scope within the specified storage + account. Encryption scope names must be between 3 and 63 characters in length and use numbers, + lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and + followed by a letter or number. + :type encryption_scope_name: str + :param encryption_scope: Encryption scope properties to be used for the create or update. + :type encryption_scope: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScope"] + 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(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + + @distributed_trace_async + async def patch( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": + """Update encryption scope properties as specified in the request body. Update fails if the + specified encryption scope does not already exist. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param encryption_scope_name: The name of the encryption scope within the specified storage + account. Encryption scope names must be between 3 and 63 characters in length and use numbers, + lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and + followed by a letter or number. + :type encryption_scope_name: str + :param encryption_scope: Encryption scope properties to be used for the update. + :type encryption_scope: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScope"] + 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(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": + """Returns the properties for the specified encryption scope. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param encryption_scope_name: The name of the encryption scope within the specified storage + account. Encryption scope names must be between 3 and 63 characters in length and use numbers, + lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and + followed by a letter or number. + :type encryption_scope_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScope"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EncryptionScopeListResult"]: + """Lists all the encryption scopes available under the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("EncryptionScopeListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py new file mode 100644 index 000000000000..f76a19ac300c --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py @@ -0,0 +1,221 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._file_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FileServicesOperations: + """FileServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": + """List all file services in storage accounts. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileServiceItems, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceItems + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileServiceItems"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileServiceItems', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + + @distributed_trace_async + async def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": + """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource + Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of file services in storage accounts, including CORS + (Cross-Origin Resource Sharing) rules. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileServiceProperties"] + 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(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + + @distributed_trace_async + async def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": + """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource + Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py new file mode 100644 index 000000000000..506bd20c450a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py @@ -0,0 +1,584 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.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._file_shares_operations import build_create_request, build_delete_request, build_get_request, build_lease_request, build_list_request, build_restore_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FileSharesOperations: + """FileSharesOperations 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.storage.v2021_08_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, + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.FileShareItems"]: + """Lists all shares. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param maxpagesize: Optional. Specified maximum number of shares that can be included in the + list. + :type maxpagesize: str + :param filter: Optional. When specified, only share names starting with the filter will be + listed. + :type filter: str + :param expand: Optional, used to expand the properties within share's properties. Valid values + are: deleted, snapshots. Should be passed as a string with delimiter ','. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FileShareItems or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.FileShareItems] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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("FileShareItems", 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": + """Creates a new share under the specified account as described by request body. The share + resource includes metadata and properties for that share. It does not include a list of the + files contained by the share. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param file_share: Properties of the file share to create. + :type file_share: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :param expand: Optional, used to expand the properties within share's properties. Valid values + are: snapshots. Should be passed as a string with delimiter ','. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileShare, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShare"] + 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(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('FileShare', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FileShare', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": + """Updates share properties as specified in request body. Properties not mentioned in the request + will not be changed. Update fails if the specified share does not already exist. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param file_share: Properties to update for the file share. + :type file_share: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileShare, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShare"] + 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(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileShare', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": + """Gets properties of a specified share. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param expand: Optional, used to expand the properties within share's properties. Valid values + are: stats. Should be passed as a string with delimiter ','. + :type expand: str + :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. + :type x_ms_snapshot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileShare, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShare"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileShare', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any + ) -> None: + """Deletes specified share under its account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param x_ms_snapshot: Optional, used to delete a snapshot. + :type x_ms_snapshot: str + :param include: Optional. Valid values are: snapshots, leased-snapshots, none. The default + value is snapshots. For 'snapshots', the file share is deleted including all of its file share + snapshots. If the file share contains leased-snapshots, the deletion fails. For + 'leased-snapshots', the file share is deleted included all of its file share snapshots + (leased/unleased). For 'none', the file share is deleted if it has no share snapshots. If the + file share contains any snapshots (leased or unleased), the deletion fails. + :type include: 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( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + include=include, + 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.CloudErrorAutoGenerated, 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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace_async + async def restore( + self, + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: + """Restore a file share within a valid retention days if share soft delete is enabled. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param deleted_share: + :type deleted_share: ~azure.mgmt.storage.v2021_08_01.models.DeletedShare + :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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + + + @distributed_trace_async + async def lease( + self, + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + parameters: Optional["_models.LeaseShareRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseShareResponse": + """The Lease Share operation establishes and manages a lock on a share for delete operations. The + lock duration can be 15 to 60 seconds, or can be infinite. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param x_ms_snapshot: Optional. Specify the snapshot time to lease a snapshot. + :type x_ms_snapshot: str + :param parameters: Lease Share request body. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.LeaseShareRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LeaseShareResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseShareResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LeaseShareResponse"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'LeaseShareRequest') + else: + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + x_ms_snapshot=x_ms_snapshot, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('LeaseShareResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py new file mode 100644 index 000000000000..fbbec3eff52a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py @@ -0,0 +1,404 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._local_users_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_keys_request, build_list_request, build_regenerate_password_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LocalUsersOperations: + """LocalUsersOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.LocalUsers": + """List the local users associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUsers, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUsers + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUsers"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUsers', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> "_models.LocalUser": + """Get the local user of the storage account by username. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUser, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUser"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUser', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + username: str, + properties: "_models.LocalUser", + **kwargs: Any + ) -> "_models.LocalUser": + """Create or update the properties of a local user associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :param properties: The local user associated with a storage account. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.LocalUser + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUser, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUser"] + 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(properties, 'LocalUser') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUser', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> None: + """Deletes the local user associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/localUsers/{username}'} # type: ignore + + + @distributed_trace_async + async def list_keys( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> "_models.LocalUserKeys": + """List SSH authorized keys and shared key of the local user. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUserKeys, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUserKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUserKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys'} # type: ignore + + + @distributed_trace_async + async def regenerate_password( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> "_models.LocalUserRegeneratePasswordResult": + """Regenerate the local user SSH password. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUserRegeneratePasswordResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserRegeneratePasswordResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUserRegeneratePasswordResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_regenerate_password_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + template_url=self.regenerate_password.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUserRegeneratePasswordResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py new file mode 100644 index 000000000000..523ba744852d --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py @@ -0,0 +1,229 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._management_policies_operations import build_create_or_update_request, build_delete_request, build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementPoliciesOperations: + """ManagementPoliciesOperations 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.storage.v2021_08_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, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": + """Gets the managementpolicy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param management_policy_name: The name of the Storage Account Management Policy. It should + always be 'default'. + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": + """Sets the managementpolicy to the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param management_policy_name: The name of the Storage Account Management Policy. It should + always be 'default'. + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyName + :param properties: The ManagementPolicy set to a storage account. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementPolicy"] + 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(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: + """Deletes the managementpolicy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param management_policy_name: The name of the Storage Account Management Policy. It should + always be 'default'. + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyName + :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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py new file mode 100644 index 000000000000..2ea172cbd9d8 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py @@ -0,0 +1,317 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._object_replication_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ObjectReplicationPoliciesOperations: + """ObjectReplicationPoliciesOperations 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.storage.v2021_08_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, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ObjectReplicationPolicies"]: + """List the object replication policies associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicies] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("ObjectReplicationPolicies", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": + """Get the object replication policy of the storage account by policy ID. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param object_replication_policy_id: For the destination account, provide the value 'default'. + Configure the policy on the destination account first. For the source account, provide the + value of the policy ID that is returned when you download the policy that was defined on the + destination account. The policy is downloaded as a JSON file. + :type object_replication_policy_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ObjectReplicationPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": + """Create or update the object replication policy of the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param object_replication_policy_id: For the destination account, provide the value 'default'. + Configure the policy on the destination account first. For the source account, provide the + value of the policy ID that is returned when you download the policy that was defined on the + destination account. The policy is downloaded as a JSON file. + :type object_replication_policy_id: str + :param properties: The object replication policy set to a storage account. A unique policy ID + will be created if absent. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ObjectReplicationPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicy"] + 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(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: + """Deletes the object replication policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param object_replication_policy_id: For the destination account, provide the value 'default'. + Configure the policy on the destination account first. For the source account, provide the + value of the policy ID that is returned when you download the policy that was defined on the + destination account. The policy is downloaded as a JSON file. + :type object_replication_policy_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py new file mode 100644 index 000000000000..a5a3d08a508a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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.storage.v2021_08_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 Storage 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.storage.v2021_08_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 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Storage/operations'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..a7c1b64f9ba1 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,309 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_put_request +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.storage.v2021_08_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, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """List all the private endpoint connections associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :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.storage.v2021_08_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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Update the state of specified private endpoint connection associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection + :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.storage.v2021_08_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.ErrorResponse, 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 + + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9f0a1e6b0627 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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_list_by_storage_account_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.storage.v2021_08_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_storage_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": + """Gets the private link resources that need to be created for a storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py new file mode 100644 index 000000000000..519df65a81c2 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py @@ -0,0 +1,397 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._queue_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueueOperations: + """QueueOperations 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.storage.v2021_08_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 create( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": + """Creates a new queue with the specified queue name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_name: str + :param queue: Queue properties and metadata to be created with. + :type queue: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageQueue, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageQueue"] + 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(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": + """Creates a new queue with the specified queue name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_name: str + :param queue: Queue properties and metadata to be created with. + :type queue: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageQueue, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageQueue"] + 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(queue, 'StorageQueue') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": + """Gets the queue with the specified queue name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageQueue, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes the queue with the specified queue name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, 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.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ListQueueResource"]: + """Gets a list of all the queues under the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param maxpagesize: Optional, a maximum number of queues that should be included in a list + queue response. + :type maxpagesize: str + :param filter: Optional, When specified, only the queues with a name starting with the given + filter will be listed. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListQueueResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListQueueResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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("ListQueueResource", 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py new file mode 100644 index 000000000000..e8e71254c382 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py @@ -0,0 +1,221 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._queue_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueueServicesOperations: + """QueueServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": + """List all queue services for the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListQueueServices, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListQueueServices + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueServices"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListQueueServices', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + + @distributed_trace_async + async def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": + """Sets the properties of a storage account’s Queue service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of a storage account’s Queue service, only properties for + Storage Analytics and CORS (Cross-Origin Resource Sharing) rules can be specified. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueServiceProperties"] + 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(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + + @distributed_trace_async + async def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": + """Gets the properties of a storage account’s Queue service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..7f43ce87fd72 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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._skus_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkusOperations: + """SkusOperations 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.storage.v2021_08_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.StorageSkuListResult"]: + """Lists the available SKUs supported by Microsoft.Storage for given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.StorageSkuListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] + 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( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_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("StorageSkuListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py new file mode 100644 index 000000000000..aab0bf562ff0 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py @@ -0,0 +1,1277 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._storage_accounts_operations import build_abort_hierarchical_namespace_migration_request_initial, build_check_name_availability_request, build_create_request_initial, build_delete_request, build_failover_request_initial, build_get_properties_request, build_hierarchical_namespace_migration_request_initial, build_list_account_sas_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_list_service_sas_request, build_regenerate_key_request, build_restore_blob_ranges_request_initial, build_revoke_user_delegation_keys_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StorageAccountsOperations: + """StorageAccountsOperations 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.storage.v2021_08_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 check_name_availability( + self, + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Checks that the storage account name is valid and is not already in use. + + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + 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(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] + 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(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.StorageAccount"]: + """Asynchronously creates a new storage account with the specified parameters. If an account is + already created and a subsequent create request is issued with different properties, the + account properties will be updated. If an account is already created and a subsequent create or + update request is issued with the exact same set of properties, the request will succeed. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide for the created account. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountCreateParameters + :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 StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_08_01.models.StorageAccount] + :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.StorageAccount"] + 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_initial( + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + 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('StorageAccount', 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + """Deletes a storage account in Microsoft Azure. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace_async + async def get_properties( + self, + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": + """Returns the properties for the specified storage account including but not limited to name, SKU + name, location, and account status. The ListKeys operation should be used to retrieve storage + keys. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param expand: May be used to expand the properties within account's properties. By default, + data is not included when fetching properties. Currently we only support geoReplicationStats + and blobRestoreStatus. + :type expand: str or ~azure.mgmt.storage.v2021_08_01.models.StorageAccountExpand + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccount, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": + """The update operation can be used to update the SKU, encryption, access tier, or tags for a + storage account. It can also be used to map the account to a custom domain. Only one custom + domain is supported per storage account; the replacement/change of custom domain is not + supported. In order to replace an old custom domain, the old value must be cleared/unregistered + before a new value can be set. The update of multiple properties is supported. This call does + not change the storage keys for the account. If you want to change the storage account keys, + use the regenerate keys operation. The location and name of the storage account cannot be + changed after creation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide for the updated account. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccount, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + 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(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountListResult"]: + """Lists all the storage accounts available under the subscription. Note that storage keys are not + returned; use the ListKeys operation for this. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.StorageAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + 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( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_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("StorageAccountListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountListResult"]: + """Lists all the storage accounts available under the given resource group. Note that storage keys + are not returned; use the ListKeys operation for this. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :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 StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.StorageAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + 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("StorageAccountListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + + @distributed_trace_async + async def list_keys( + self, + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": + """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage + account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountListKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListKeysResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('StorageAccountListKeysResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + + @distributed_trace_async + async def regenerate_key( + self, + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": + """Regenerates one of the access keys or Kerberos keys for the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, + kerb1, kerb2. + :type regenerate_key: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountRegenerateKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountListKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListKeysResult"] + 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(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('StorageAccountListKeysResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + + @distributed_trace_async + async def list_account_sas( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": + """List SAS credentials of a storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide to list SAS credentials for the storage account. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.AccountSasParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListAccountSasResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListAccountSasResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListAccountSasResponse"] + 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(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('ListAccountSasResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + + @distributed_trace_async + async def list_service_sas( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": + """List service SAS credentials of a specific resource. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide to list service SAS credentials. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.ServiceSasParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListServiceSasResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListServiceSasResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListServiceSasResponse"] + 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(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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('ListServiceSasResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + + + async def _failover_initial( + self, + resource_group_name: str, + account_name: str, + **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', {})) + + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._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, {}) + + _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + + @distributed_trace_async + async def begin_failover( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Failover request can be triggered for a storage account in case of availability issues. The + failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS + accounts. The secondary cluster will become primary after failover. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, 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._failover_initial( + resource_group_name=resource_group_name, + account_name=account_name, + 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, lro_options={'final-state-via': 'location'}, **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_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + async def _hierarchical_namespace_migration_initial( + self, + resource_group_name: str, + account_name: str, + request_type: str, + **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', {})) + + + request = build_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + request_type=request_type, + template_url=self._hierarchical_namespace_migration_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, {}) + + _hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore + + + @distributed_trace_async + async def begin_hierarchical_namespace_migration( + self, + resource_group_name: str, + account_name: str, + request_type: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Live Migration of storage account to enable Hns. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param request_type: Required. Hierarchical namespace migration type can either be a + hierarchical namespace validation request 'HnsOnValidationRequest' or a hydration request + 'HnsOnHydrationRequest'. The validation request will validate the migration whereas the + hydration request will migrate the account. + :type request_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 + 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 + """ + 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._hierarchical_namespace_migration_initial( + resource_group_name=resource_group_name, + account_name=account_name, + request_type=request_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, lro_options={'final-state-via': 'location'}, **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_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore + + async def _abort_hierarchical_namespace_migration_initial( + self, + resource_group_name: str, + account_name: str, + **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', {})) + + + request = build_abort_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._abort_hierarchical_namespace_migration_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, {}) + + _abort_hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore + + + @distributed_trace_async + async def begin_abort_hierarchical_namespace_migration( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Abort live Migration of storage account to enable Hns. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, 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._abort_hierarchical_namespace_migration_initial( + resource_group_name=resource_group_name, + account_name=account_name, + 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, lro_options={'final-state-via': 'location'}, **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_abort_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore + + async def _restore_blob_ranges_initial( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] + 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(parameters, 'BlobRestoreParameters') + + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_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 response.status_code == 200: + deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + + @distributed_trace_async + async def begin_restore_blob_ranges( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.BlobRestoreStatus"]: + """Restore blobs in the specified blob ranges. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide for restore blob ranges. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.BlobRestoreParameters + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storage.v2021_08_01.models.BlobRestoreStatus] + :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.BlobRestoreStatus"] + 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._restore_blob_ranges_initial( + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + 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('BlobRestoreStatus', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace_async + async def revoke_user_delegation_keys( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + """Revoke user delegation keys. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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) + + if cls: + return cls(pipeline_response, None, {}) + + revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py new file mode 100644 index 000000000000..e36bf8437ad1 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py @@ -0,0 +1,365 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._table_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TableOperations: + """TableOperations 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.storage.v2021_08_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 create( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": + """Creates a new table with the specified table name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Table, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Table"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Table', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": + """Creates a new table with the specified table name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Table, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Table"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Table', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": + """Gets the table with the specified table name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Table, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Table"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Table', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: + """Deletes the table with the specified table name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, 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.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ListTableResource"]: + """Gets a list of all the tables under the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListTableResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListTableResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("ListTableResource", 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py new file mode 100644 index 000000000000..df88ae9c90b5 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py @@ -0,0 +1,221 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._table_services_operations import build_get_service_properties_request, build_list_request, build_set_service_properties_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TableServicesOperations: + """TableServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": + """List all table services for the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListTableServices, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListTableServices + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableServices"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListTableServices', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + + @distributed_trace_async + async def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": + """Sets the properties of a storage account’s Table service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of a storage account’s Table service, only properties for + Storage Analytics and CORS (Cross-Origin Resource Sharing) rules can be specified. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableServiceProperties"] + 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(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TableServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + + @distributed_trace_async + async def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": + """Gets the properties of a storage account’s Table service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TableServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py new file mode 100644 index 000000000000..3c7ee089fbf7 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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._usages_operations import build_list_by_location_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UsagesOperations: + """UsagesOperations 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.storage.v2021_08_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_by_location( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.UsageListResult"]: + """Gets the current usage count and the limit for the resources of the location under the + subscription. + + :param location: The location of the Azure Storage resource. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storage.v2021_08_01.models.UsageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] + 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_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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("UsageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py new file mode 100644 index 000000000000..d3d4885dbbda --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py @@ -0,0 +1,433 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 AccessPolicy +from ._models_py3 import AccountImmutabilityPolicyProperties +from ._models_py3 import AccountSasParameters +from ._models_py3 import ActiveDirectoryProperties +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureFilesIdentityBasedAuthentication +from ._models_py3 import BlobContainer +from ._models_py3 import BlobInventoryPolicy +from ._models_py3 import BlobInventoryPolicyDefinition +from ._models_py3 import BlobInventoryPolicyFilter +from ._models_py3 import BlobInventoryPolicyRule +from ._models_py3 import BlobInventoryPolicySchema +from ._models_py3 import BlobRestoreParameters +from ._models_py3 import BlobRestoreRange +from ._models_py3 import BlobRestoreStatus +from ._models_py3 import BlobServiceItems +from ._models_py3 import BlobServiceProperties +from ._models_py3 import ChangeFeed +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorAutoGenerated +from ._models_py3 import CloudErrorBody +from ._models_py3 import CloudErrorBodyAutoGenerated +from ._models_py3 import CorsRule +from ._models_py3 import CorsRules +from ._models_py3 import CustomDomain +from ._models_py3 import DateAfterCreation +from ._models_py3 import DateAfterModification +from ._models_py3 import DeleteRetentionPolicy +from ._models_py3 import DeletedAccount +from ._models_py3 import DeletedAccountListResult +from ._models_py3 import DeletedShare +from ._models_py3 import Dimension +from ._models_py3 import Encryption +from ._models_py3 import EncryptionIdentity +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeKeyVaultProperties +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionService +from ._models_py3 import EncryptionServices +from ._models_py3 import Endpoints +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import FileServiceItems +from ._models_py3 import FileServiceProperties +from ._models_py3 import FileShare +from ._models_py3 import FileShareItem +from ._models_py3 import FileShareItems +from ._models_py3 import GeoReplicationStats +from ._models_py3 import IPRule +from ._models_py3 import Identity +from ._models_py3 import ImmutabilityPolicy +from ._models_py3 import ImmutabilityPolicyProperties +from ._models_py3 import ImmutableStorageAccount +from ._models_py3 import ImmutableStorageWithVersioning +from ._models_py3 import KeyCreationTime +from ._models_py3 import KeyPolicy +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LastAccessTimeTrackingPolicy +from ._models_py3 import LeaseContainerRequest +from ._models_py3 import LeaseContainerResponse +from ._models_py3 import LeaseShareRequest +from ._models_py3 import LeaseShareResponse +from ._models_py3 import LegalHold +from ._models_py3 import LegalHoldProperties +from ._models_py3 import ListAccountSasResponse +from ._models_py3 import ListBlobInventoryPolicy +from ._models_py3 import ListContainerItem +from ._models_py3 import ListContainerItems +from ._models_py3 import ListQueue +from ._models_py3 import ListQueueResource +from ._models_py3 import ListQueueServices +from ._models_py3 import ListServiceSasResponse +from ._models_py3 import ListTableResource +from ._models_py3 import ListTableServices +from ._models_py3 import LocalUser +from ._models_py3 import LocalUserKeys +from ._models_py3 import LocalUserRegeneratePasswordResult +from ._models_py3 import LocalUsers +from ._models_py3 import ManagementPolicy +from ._models_py3 import ManagementPolicyAction +from ._models_py3 import ManagementPolicyBaseBlob +from ._models_py3 import ManagementPolicyDefinition +from ._models_py3 import ManagementPolicyFilter +from ._models_py3 import ManagementPolicyRule +from ._models_py3 import ManagementPolicySchema +from ._models_py3 import ManagementPolicySnapShot +from ._models_py3 import ManagementPolicyVersion +from ._models_py3 import MetricSpecification +from ._models_py3 import Multichannel +from ._models_py3 import NetworkRuleSet +from ._models_py3 import ObjectReplicationPolicies +from ._models_py3 import ObjectReplicationPolicy +from ._models_py3 import ObjectReplicationPolicyFilter +from ._models_py3 import ObjectReplicationPolicyRule +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PermissionScope +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProtectedAppendWritesHistory +from ._models_py3 import ProtocolSettings +from ._models_py3 import ProxyResource +from ._models_py3 import QueueServiceProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceAccessRule +from ._models_py3 import RestorePolicyProperties +from ._models_py3 import Restriction +from ._models_py3 import RoutingPreference +from ._models_py3 import SKUCapability +from ._models_py3 import SasPolicy +from ._models_py3 import ServiceSasParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import SignedIdentifier +from ._models_py3 import Sku +from ._models_py3 import SkuInformation +from ._models_py3 import SmbSetting +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCheckNameAvailabilityParameters +from ._models_py3 import StorageAccountCreateParameters +from ._models_py3 import StorageAccountInternetEndpoints +from ._models_py3 import StorageAccountKey +from ._models_py3 import StorageAccountListKeysResult +from ._models_py3 import StorageAccountListResult +from ._models_py3 import StorageAccountMicrosoftEndpoints +from ._models_py3 import StorageAccountRegenerateKeyParameters +from ._models_py3 import StorageAccountUpdateParameters +from ._models_py3 import StorageQueue +from ._models_py3 import StorageSkuListResult +from ._models_py3 import SystemData +from ._models_py3 import Table +from ._models_py3 import TableServiceProperties +from ._models_py3 import TagFilter +from ._models_py3 import TagProperty +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateHistoryProperty +from ._models_py3 import Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VirtualNetworkRule + + +from ._storage_management_client_enums import ( + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + ActiveDirectoryPropertiesAccountType, + AllowedCopyScope, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) + +__all__ = [ + 'AccessPolicy', + 'AccountImmutabilityPolicyProperties', + 'AccountSasParameters', + 'ActiveDirectoryProperties', + 'AzureEntityResource', + 'AzureFilesIdentityBasedAuthentication', + 'BlobContainer', + 'BlobInventoryPolicy', + 'BlobInventoryPolicyDefinition', + 'BlobInventoryPolicyFilter', + 'BlobInventoryPolicyRule', + 'BlobInventoryPolicySchema', + 'BlobRestoreParameters', + 'BlobRestoreRange', + 'BlobRestoreStatus', + 'BlobServiceItems', + 'BlobServiceProperties', + 'ChangeFeed', + 'CheckNameAvailabilityResult', + 'CloudErrorAutoGenerated', + 'CloudErrorBody', + 'CloudErrorBodyAutoGenerated', + 'CorsRule', + 'CorsRules', + 'CustomDomain', + 'DateAfterCreation', + 'DateAfterModification', + 'DeleteRetentionPolicy', + 'DeletedAccount', + 'DeletedAccountListResult', + 'DeletedShare', + 'Dimension', + 'Encryption', + 'EncryptionIdentity', + 'EncryptionScope', + 'EncryptionScopeKeyVaultProperties', + 'EncryptionScopeListResult', + 'EncryptionService', + 'EncryptionServices', + 'Endpoints', + 'ErrorResponse', + 'ErrorResponseBody', + 'ExtendedLocation', + 'FileServiceItems', + 'FileServiceProperties', + 'FileShare', + 'FileShareItem', + 'FileShareItems', + 'GeoReplicationStats', + 'IPRule', + 'Identity', + 'ImmutabilityPolicy', + 'ImmutabilityPolicyProperties', + 'ImmutableStorageAccount', + 'ImmutableStorageWithVersioning', + 'KeyCreationTime', + 'KeyPolicy', + 'KeyVaultProperties', + 'LastAccessTimeTrackingPolicy', + 'LeaseContainerRequest', + 'LeaseContainerResponse', + 'LeaseShareRequest', + 'LeaseShareResponse', + 'LegalHold', + 'LegalHoldProperties', + 'ListAccountSasResponse', + 'ListBlobInventoryPolicy', + 'ListContainerItem', + 'ListContainerItems', + 'ListQueue', + 'ListQueueResource', + 'ListQueueServices', + 'ListServiceSasResponse', + 'ListTableResource', + 'ListTableServices', + 'LocalUser', + 'LocalUserKeys', + 'LocalUserRegeneratePasswordResult', + 'LocalUsers', + 'ManagementPolicy', + 'ManagementPolicyAction', + 'ManagementPolicyBaseBlob', + 'ManagementPolicyDefinition', + 'ManagementPolicyFilter', + 'ManagementPolicyRule', + 'ManagementPolicySchema', + 'ManagementPolicySnapShot', + 'ManagementPolicyVersion', + 'MetricSpecification', + 'Multichannel', + 'NetworkRuleSet', + 'ObjectReplicationPolicies', + 'ObjectReplicationPolicy', + 'ObjectReplicationPolicyFilter', + 'ObjectReplicationPolicyRule', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PermissionScope', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'ProtectedAppendWritesHistory', + 'ProtocolSettings', + 'ProxyResource', + 'QueueServiceProperties', + 'Resource', + 'ResourceAccessRule', + 'RestorePolicyProperties', + 'Restriction', + 'RoutingPreference', + 'SKUCapability', + 'SasPolicy', + 'ServiceSasParameters', + 'ServiceSpecification', + 'SignedIdentifier', + 'Sku', + 'SkuInformation', + 'SmbSetting', + 'SshPublicKey', + 'StorageAccount', + 'StorageAccountCheckNameAvailabilityParameters', + 'StorageAccountCreateParameters', + 'StorageAccountInternetEndpoints', + 'StorageAccountKey', + 'StorageAccountListKeysResult', + 'StorageAccountListResult', + 'StorageAccountMicrosoftEndpoints', + 'StorageAccountRegenerateKeyParameters', + 'StorageAccountUpdateParameters', + 'StorageQueue', + 'StorageSkuListResult', + 'SystemData', + 'Table', + 'TableServiceProperties', + 'TagFilter', + 'TagProperty', + 'TrackedResource', + 'UpdateHistoryProperty', + 'Usage', + 'UsageListResult', + 'UsageName', + 'UserAssignedIdentity', + 'VirtualNetworkRule', + 'AccessTier', + 'AccountImmutabilityPolicyState', + 'AccountStatus', + 'ActiveDirectoryPropertiesAccountType', + 'AllowedCopyScope', + 'BlobInventoryPolicyName', + 'BlobRestoreProgressStatus', + 'Bypass', + 'CorsRuleAllowedMethodsItem', + 'CreatedByType', + 'DefaultAction', + 'DefaultSharePermission', + 'DirectoryServiceOptions', + 'EnabledProtocols', + 'EncryptionScopeSource', + 'EncryptionScopeState', + 'ExpirationAction', + 'ExtendedLocationTypes', + 'Format', + 'GeoReplicationStatus', + 'HttpProtocol', + 'IdentityType', + 'ImmutabilityPolicyState', + 'ImmutabilityPolicyUpdateType', + 'InventoryRuleType', + 'KeyPermission', + 'KeySource', + 'KeyType', + 'Kind', + 'LargeFileSharesState', + 'LeaseContainerRequestAction', + 'LeaseDuration', + 'LeaseShareAction', + 'LeaseState', + 'LeaseStatus', + 'ListContainersInclude', + 'ManagementPolicyName', + 'MigrationState', + 'MinimumTlsVersion', + 'Name', + 'ObjectType', + 'Permissions', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'ProvisioningState', + 'PublicAccess', + 'PublicNetworkAccess', + 'Reason', + 'ReasonCode', + 'RootSquashType', + 'RoutingChoice', + 'RuleType', + 'Schedule', + 'Services', + 'ShareAccessTier', + 'SignedResource', + 'SignedResourceTypes', + 'SkuName', + 'SkuTier', + 'State', + 'StorageAccountExpand', + 'UsageUnit', +] diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py new file mode 100644 index 000000000000..cd6e033ecae9 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py @@ -0,0 +1,8151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._storage_management_client_enums import * + + +class AccessPolicy(msrest.serialization.Model): + """AccessPolicy. + + :ivar start_time: Start time of the access policy. + :vartype start_time: ~datetime.datetime + :ivar expiry_time: Expiry time of the access policy. + :vartype expiry_time: ~datetime.datetime + :ivar permission: List of abbreviated permissions. + :vartype permission: str + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'permission': {'key': 'permission', 'type': 'str'}, + } + + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + expiry_time: Optional[datetime.datetime] = None, + permission: Optional[str] = None, + **kwargs + ): + """ + :keyword start_time: Start time of the access policy. + :paramtype start_time: ~datetime.datetime + :keyword expiry_time: Expiry time of the access policy. + :paramtype expiry_time: ~datetime.datetime + :keyword permission: List of abbreviated permissions. + :paramtype permission: str + """ + super(AccessPolicy, self).__init__(**kwargs) + self.start_time = start_time + self.expiry_time = expiry_time + self.permission = permission + + +class AccountImmutabilityPolicyProperties(msrest.serialization.Model): + """This defines account-level immutability policy properties. + + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the + container since the policy creation, in days. + :vartype immutability_period_since_creation_in_days: int + :ivar state: The ImmutabilityPolicy state defines the mode of the policy. Disabled state + disables the policy, Unlocked state allows increase and decrease of immutability retention time + and also allows toggling allowProtectedAppendWrites property, Locked state only allows the + increase of the immutability retention time. A policy can only be created in a Disabled or + Unlocked state and can be toggled between the two states. Only a policy in an Unlocked state + can transition to a Locked state which cannot be reverted. Possible values include: "Unlocked", + "Locked", "Disabled". + :vartype state: str or ~azure.mgmt.storage.v2021_08_01.models.AccountImmutabilityPolicyState + :ivar allow_protected_append_writes: This property can only be changed for disabled and + unlocked time-based retention policies. When enabled, new blocks can be written to an append + blob while maintaining immutability protection and compliance. Only new blocks can be added and + any existing blocks cannot be modified or deleted. + :vartype allow_protected_append_writes: bool + """ + + _validation = { + 'immutability_period_since_creation_in_days': {'maximum': 146000, 'minimum': 1}, + } + + _attribute_map = { + 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, + 'state': {'key': 'state', 'type': 'str'}, + 'allow_protected_append_writes': {'key': 'allowProtectedAppendWrites', 'type': 'bool'}, + } + + def __init__( + self, + *, + immutability_period_since_creation_in_days: Optional[int] = None, + state: Optional[Union[str, "AccountImmutabilityPolicyState"]] = None, + allow_protected_append_writes: Optional[bool] = None, + **kwargs + ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword state: The ImmutabilityPolicy state defines the mode of the policy. Disabled state + disables the policy, Unlocked state allows increase and decrease of immutability retention time + and also allows toggling allowProtectedAppendWrites property, Locked state only allows the + increase of the immutability retention time. A policy can only be created in a Disabled or + Unlocked state and can be toggled between the two states. Only a policy in an Unlocked state + can transition to a Locked state which cannot be reverted. Possible values include: "Unlocked", + "Locked", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_08_01.models.AccountImmutabilityPolicyState + :keyword allow_protected_append_writes: This property can only be changed for disabled and + unlocked time-based retention policies. When enabled, new blocks can be written to an append + blob while maintaining immutability protection and compliance. Only new blocks can be added and + any existing blocks cannot be modified or deleted. + :paramtype allow_protected_append_writes: bool + """ + super(AccountImmutabilityPolicyProperties, self).__init__(**kwargs) + self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days + self.state = state + self.allow_protected_append_writes = allow_protected_append_writes + + +class AccountSasParameters(msrest.serialization.Model): + """The parameters to list SAS credentials of a storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar services: Required. The signed services accessible with the account SAS. Possible values + include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", "t", "f". + :vartype services: str or ~azure.mgmt.storage.v2021_08_01.models.Services + :ivar resource_types: Required. The signed resource types that are accessible with the account + SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; + Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. + Possible values include: "s", "c", "o". + :vartype resource_types: str or ~azure.mgmt.storage.v2021_08_01.models.SignedResourceTypes + :ivar permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :vartype permissions: str or ~azure.mgmt.storage.v2021_08_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :vartype protocols: str or ~azure.mgmt.storage.v2021_08_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + """ + + _validation = { + 'services': {'required': True}, + 'resource_types': {'required': True}, + 'permissions': {'required': True}, + 'shared_access_expiry_time': {'required': True}, + } + + _attribute_map = { + 'services': {'key': 'signedServices', 'type': 'str'}, + 'resource_types': {'key': 'signedResourceTypes', 'type': 'str'}, + 'permissions': {'key': 'signedPermission', 'type': 'str'}, + 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, + 'protocols': {'key': 'signedProtocol', 'type': 'str'}, + 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, + 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, + 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, + } + + def __init__( + self, + *, + services: Union[str, "Services"], + resource_types: Union[str, "SignedResourceTypes"], + permissions: Union[str, "Permissions"], + shared_access_expiry_time: datetime.datetime, + ip_address_or_range: Optional[str] = None, + protocols: Optional[Union[str, "HttpProtocol"]] = None, + shared_access_start_time: Optional[datetime.datetime] = None, + key_to_sign: Optional[str] = None, + **kwargs + ): + """ + :keyword services: Required. The signed services accessible with the account SAS. Possible + values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: "b", "q", + "t", "f". + :paramtype services: str or ~azure.mgmt.storage.v2021_08_01.models.Services + :keyword resource_types: Required. The signed resource types that are accessible with the + account SAS. Service (s): Access to service-level APIs; Container (c): Access to + container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table + entities, and files. Possible values include: "s", "c", "o". + :paramtype resource_types: str or ~azure.mgmt.storage.v2021_08_01.models.SignedResourceTypes + :keyword permissions: Required. The signed permissions for the account SAS. Possible values + include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process + (p). Possible values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_08_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_08_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: Required. The time at which the shared access signature + becomes invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + """ + super(AccountSasParameters, self).__init__(**kwargs) + self.services = services + self.resource_types = resource_types + self.permissions = permissions + self.ip_address_or_range = ip_address_or_range + self.protocols = protocols + self.shared_access_start_time = shared_access_start_time + self.shared_access_expiry_time = shared_access_expiry_time + self.key_to_sign = key_to_sign + + +class ActiveDirectoryProperties(msrest.serialization.Model): + """Settings properties for Active Directory (AD). + + All required parameters must be populated in order to send to Azure. + + :ivar domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :vartype domain_name: str + :ivar net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :vartype net_bios_domain_name: str + :ivar forest_name: Required. Specifies the Active Directory forest to get. + :vartype forest_name: str + :ivar domain_guid: Required. Specifies the domain GUID. + :vartype domain_guid: str + :ivar domain_sid: Required. Specifies the security identifier (SID). + :vartype domain_sid: str + :ivar azure_storage_sid: Required. Specifies the security identifier (SID) for Azure Storage. + :vartype azure_storage_sid: str + :ivar sam_account_name: Specifies the Active Directory SAMAccountName for Azure Storage. + :vartype sam_account_name: str + :ivar account_type: Specifies the Active Directory account type for Azure Storage. Possible + values include: "User", "Computer". + :vartype account_type: str or + ~azure.mgmt.storage.v2021_08_01.models.ActiveDirectoryPropertiesAccountType + """ + + _validation = { + 'domain_name': {'required': True}, + 'net_bios_domain_name': {'required': True}, + 'forest_name': {'required': True}, + 'domain_guid': {'required': True}, + 'domain_sid': {'required': True}, + 'azure_storage_sid': {'required': True}, + } + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'net_bios_domain_name': {'key': 'netBiosDomainName', 'type': 'str'}, + 'forest_name': {'key': 'forestName', 'type': 'str'}, + 'domain_guid': {'key': 'domainGuid', 'type': 'str'}, + 'domain_sid': {'key': 'domainSid', 'type': 'str'}, + 'azure_storage_sid': {'key': 'azureStorageSid', 'type': 'str'}, + 'sam_account_name': {'key': 'samAccountName', 'type': 'str'}, + 'account_type': {'key': 'accountType', 'type': 'str'}, + } + + def __init__( + self, + *, + domain_name: str, + net_bios_domain_name: str, + forest_name: str, + domain_guid: str, + domain_sid: str, + azure_storage_sid: str, + sam_account_name: Optional[str] = None, + account_type: Optional[Union[str, "ActiveDirectoryPropertiesAccountType"]] = None, + **kwargs + ): + """ + :keyword domain_name: Required. Specifies the primary domain that the AD DNS server is + authoritative for. + :paramtype domain_name: str + :keyword net_bios_domain_name: Required. Specifies the NetBIOS domain name. + :paramtype net_bios_domain_name: str + :keyword forest_name: Required. Specifies the Active Directory forest to get. + :paramtype forest_name: str + :keyword domain_guid: Required. Specifies the domain GUID. + :paramtype domain_guid: str + :keyword domain_sid: Required. Specifies the security identifier (SID). + :paramtype domain_sid: str + :keyword azure_storage_sid: Required. Specifies the security identifier (SID) for Azure + Storage. + :paramtype azure_storage_sid: str + :keyword sam_account_name: Specifies the Active Directory SAMAccountName for Azure Storage. + :paramtype sam_account_name: str + :keyword account_type: Specifies the Active Directory account type for Azure Storage. Possible + values include: "User", "Computer". + :paramtype account_type: str or + ~azure.mgmt.storage.v2021_08_01.models.ActiveDirectoryPropertiesAccountType + """ + super(ActiveDirectoryProperties, self).__init__(**kwargs) + self.domain_name = domain_name + self.net_bios_domain_name = net_bios_domain_name + self.forest_name = forest_name + self.domain_guid = domain_guid + self.domain_sid = domain_sid + self.azure_storage_sid = azure_storage_sid + self.sam_account_name = sam_account_name + self.account_type = account_type + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with an etag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class AzureFilesIdentityBasedAuthentication(msrest.serialization.Model): + """Settings for Azure Files identity based authentication. + + All required parameters must be populated in order to send to Azure. + + :ivar directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :vartype directory_service_options: str or + ~azure.mgmt.storage.v2021_08_01.models.DirectoryServiceOptions + :ivar active_directory_properties: Required if choose AD. + :vartype active_directory_properties: + ~azure.mgmt.storage.v2021_08_01.models.ActiveDirectoryProperties + :ivar default_share_permission: Default share permission for users using Kerberos + authentication if RBAC role is not assigned. Possible values include: "None", + "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", + "StorageFileDataSmbShareElevatedContributor". + :vartype default_share_permission: str or + ~azure.mgmt.storage.v2021_08_01.models.DefaultSharePermission + """ + + _validation = { + 'directory_service_options': {'required': True}, + } + + _attribute_map = { + 'directory_service_options': {'key': 'directoryServiceOptions', 'type': 'str'}, + 'active_directory_properties': {'key': 'activeDirectoryProperties', 'type': 'ActiveDirectoryProperties'}, + 'default_share_permission': {'key': 'defaultSharePermission', 'type': 'str'}, + } + + def __init__( + self, + *, + directory_service_options: Union[str, "DirectoryServiceOptions"], + active_directory_properties: Optional["ActiveDirectoryProperties"] = None, + default_share_permission: Optional[Union[str, "DefaultSharePermission"]] = None, + **kwargs + ): + """ + :keyword directory_service_options: Required. Indicates the directory service used. Possible + values include: "None", "AADDS", "AD". + :paramtype directory_service_options: str or + ~azure.mgmt.storage.v2021_08_01.models.DirectoryServiceOptions + :keyword active_directory_properties: Required if choose AD. + :paramtype active_directory_properties: + ~azure.mgmt.storage.v2021_08_01.models.ActiveDirectoryProperties + :keyword default_share_permission: Default share permission for users using Kerberos + authentication if RBAC role is not assigned. Possible values include: "None", + "StorageFileDataSmbShareReader", "StorageFileDataSmbShareContributor", + "StorageFileDataSmbShareElevatedContributor". + :paramtype default_share_permission: str or + ~azure.mgmt.storage.v2021_08_01.models.DefaultSharePermission + """ + super(AzureFilesIdentityBasedAuthentication, self).__init__(**kwargs) + self.directory_service_options = directory_service_options + self.active_directory_properties = active_directory_properties + self.default_share_permission = default_share_permission + + +class BlobContainer(AzureEntityResource): + """Properties of the blob container, including Id, resource name, resource type, Etag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar version: The version of the deleted blob container. + :vartype version: str + :ivar deleted: Indicates whether the blob container was deleted. + :vartype deleted: bool + :ivar deleted_time: Blob container deletion time. + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. + :vartype remaining_retention_days: int + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container + default. + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the + level of access. Possible values include: "Container", "Blob", "None". + :vartype public_access: str or ~azure.mgmt.storage.v2021_08_01.models.PublicAccess + :ivar last_modified_time: Returns the date and time the container was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar lease_status: The lease status of the container. Possible values include: "Locked", + "Unlocked". + :vartype lease_status: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseStatus + :ivar lease_state: Lease state of the container. Possible values include: "Available", + "Leased", "Expired", "Breaking", "Broken". + :vartype lease_state: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseState + :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed + duration, only when the container is leased. Possible values include: "Infinite", "Fixed". + :vartype lease_duration: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseDuration + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] + :ivar immutability_policy: The ImmutabilityPolicy property of the container. + :vartype immutability_policy: + ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicyProperties + :ivar legal_hold: The LegalHold property of the container. + :vartype legal_hold: ~azure.mgmt.storage.v2021_08_01.models.LegalHoldProperties + :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at + least one existing tag. The hasLegalHold public property is set to false by SRP if all existing + legal hold tags are cleared out. There can be a maximum of 1000 blob containers with + hasLegalHold=true for a given account. + :vartype has_legal_hold: bool + :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP + if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public + property is set to false by SRP if ImmutabilityPolicy has not been created for this container. + :vartype has_immutability_policy: bool + :ivar immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :vartype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageWithVersioning + :ivar enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :vartype enable_nfs_v3_root_squash: bool + :ivar enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :vartype enable_nfs_v3_all_squash: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'lease_status': {'readonly': True}, + 'lease_state': {'readonly': True}, + 'lease_duration': {'readonly': True}, + 'immutability_policy': {'readonly': True}, + 'legal_hold': {'readonly': True}, + 'has_legal_hold': {'readonly': True}, + 'has_immutability_policy': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, + 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, + 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, + 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, + 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, + 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, + 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, + 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageWithVersioning'}, + 'enable_nfs_v3_root_squash': {'key': 'properties.enableNfsV3RootSquash', 'type': 'bool'}, + 'enable_nfs_v3_all_squash': {'key': 'properties.enableNfsV3AllSquash', 'type': 'bool'}, + } + + def __init__( + self, + *, + default_encryption_scope: Optional[str] = None, + deny_encryption_scope_override: Optional[bool] = None, + public_access: Optional[Union[str, "PublicAccess"]] = None, + metadata: Optional[Dict[str, str]] = None, + immutable_storage_with_versioning: Optional["ImmutableStorageWithVersioning"] = None, + enable_nfs_v3_root_squash: Optional[bool] = None, + enable_nfs_v3_all_squash: Optional[bool] = None, + **kwargs + ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_08_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + :keyword immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageWithVersioning + :keyword enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :paramtype enable_nfs_v3_root_squash: bool + :keyword enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :paramtype enable_nfs_v3_all_squash: bool + """ + super(BlobContainer, self).__init__(**kwargs) + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.default_encryption_scope = default_encryption_scope + self.deny_encryption_scope_override = deny_encryption_scope_override + self.public_access = public_access + self.last_modified_time = None + self.lease_status = None + self.lease_state = None + self.lease_duration = None + self.metadata = metadata + self.immutability_policy = None + self.legal_hold = None + self.has_legal_hold = None + self.has_immutability_policy = None + self.immutable_storage_with_versioning = immutable_storage_with_versioning + self.enable_nfs_v3_root_squash = enable_nfs_v3_root_squash + self.enable_nfs_v3_all_squash = enable_nfs_v3_all_squash + + +class BlobInventoryPolicy(Resource): + """The storage account blob inventory policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.storage.v2021_08_01.models.SystemData + :ivar last_modified_time: Returns the last modified date and time of the blob inventory policy. + :vartype last_modified_time: ~datetime.datetime + :ivar policy: The storage account blob inventory policy object. It is composed of policy rules. + :vartype policy: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicySchema + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'policy': {'key': 'properties.policy', 'type': 'BlobInventoryPolicySchema'}, + } + + def __init__( + self, + *, + policy: Optional["BlobInventoryPolicySchema"] = None, + **kwargs + ): + """ + :keyword policy: The storage account blob inventory policy object. It is composed of policy + rules. + :paramtype policy: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicySchema + """ + super(BlobInventoryPolicy, self).__init__(**kwargs) + self.system_data = None + self.last_modified_time = None + self.policy = policy + + +class BlobInventoryPolicyDefinition(msrest.serialization.Model): + """An object that defines the blob inventory rule. + + All required parameters must be populated in order to send to Azure. + + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyFilter + :ivar format: Required. This is a required field, it specifies the format for the inventory + files. Possible values include: "Csv", "Parquet". + :vartype format: str or ~azure.mgmt.storage.v2021_08_01.models.Format + :ivar schedule: Required. This is a required field. This field is used to schedule an inventory + formation. Possible values include: "Daily", "Weekly". + :vartype schedule: str or ~azure.mgmt.storage.v2021_08_01.models.Schedule + :ivar object_type: Required. This is a required field. This field specifies the scope of the + inventory created either at the blob or container level. Possible values include: "Blob", + "Container". + :vartype object_type: str or ~azure.mgmt.storage.v2021_08_01.models.ObjectType + :ivar schema_fields: Required. This is a required field. This field specifies the fields and + properties of the object to be included in the inventory. The Schema field value 'Name' is + always required. The valid values for this field for the 'Blob' definition.objectType include + 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, + AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, hdi_isfolder, Owner, Group, + Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid + values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, + LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. + Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only + for Hns enabled accounts.'Tags' field is only valid for non Hns accounts. + :vartype schema_fields: list[str] + """ + + _validation = { + 'format': {'required': True}, + 'schedule': {'required': True}, + 'object_type': {'required': True}, + 'schema_fields': {'required': True}, + } + + _attribute_map = { + 'filters': {'key': 'filters', 'type': 'BlobInventoryPolicyFilter'}, + 'format': {'key': 'format', 'type': 'str'}, + 'schedule': {'key': 'schedule', 'type': 'str'}, + 'object_type': {'key': 'objectType', 'type': 'str'}, + 'schema_fields': {'key': 'schemaFields', 'type': '[str]'}, + } + + def __init__( + self, + *, + format: Union[str, "Format"], + schedule: Union[str, "Schedule"], + object_type: Union[str, "ObjectType"], + schema_fields: List[str], + filters: Optional["BlobInventoryPolicyFilter"] = None, + **kwargs + ): + """ + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyFilter + :keyword format: Required. This is a required field, it specifies the format for the inventory + files. Possible values include: "Csv", "Parquet". + :paramtype format: str or ~azure.mgmt.storage.v2021_08_01.models.Format + :keyword schedule: Required. This is a required field. This field is used to schedule an + inventory formation. Possible values include: "Daily", "Weekly". + :paramtype schedule: str or ~azure.mgmt.storage.v2021_08_01.models.Schedule + :keyword object_type: Required. This is a required field. This field specifies the scope of the + inventory created either at the blob or container level. Possible values include: "Blob", + "Container". + :paramtype object_type: str or ~azure.mgmt.storage.v2021_08_01.models.ObjectType + :keyword schema_fields: Required. This is a required field. This field specifies the fields and + properties of the object to be included in the inventory. The Schema field value 'Name' is + always required. The valid values for this field for the 'Blob' definition.objectType include + 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, + AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, hdi_isfolder, Owner, Group, + Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid + values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, + LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. + Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only + for Hns enabled accounts.'Tags' field is only valid for non Hns accounts. + :paramtype schema_fields: list[str] + """ + super(BlobInventoryPolicyDefinition, self).__init__(**kwargs) + self.filters = filters + self.format = format + self.schedule = schedule + self.object_type = object_type + self.schema_fields = schema_fields + + +class BlobInventoryPolicyFilter(msrest.serialization.Model): + """An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. + + :ivar prefix_match: An array of strings for blob prefixes to be matched. + :vartype prefix_match: list[str] + :ivar blob_types: An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when + definition.objectType property is set to 'Blob'. + :vartype blob_types: list[str] + :ivar include_blob_versions: Includes blob versions in blob inventory when value is set to + true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this + property is set to true, else they must be excluded. + :vartype include_blob_versions: bool + :ivar include_snapshots: Includes blob snapshots in blob inventory when value is set to true. + The definition.schemaFields value 'Snapshot' is required if this property is set to true, else + it must be excluded. + :vartype include_snapshots: bool + """ + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, + 'include_blob_versions': {'key': 'includeBlobVersions', 'type': 'bool'}, + 'include_snapshots': {'key': 'includeSnapshots', 'type': 'bool'}, + } + + def __init__( + self, + *, + prefix_match: Optional[List[str]] = None, + blob_types: Optional[List[str]] = None, + include_blob_versions: Optional[bool] = None, + include_snapshots: Optional[bool] = None, + **kwargs + ): + """ + :keyword prefix_match: An array of strings for blob prefixes to be matched. + :paramtype prefix_match: list[str] + :keyword blob_types: An array of predefined enum values. Valid values include blockBlob, + appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when + definition.objectType property is set to 'Blob'. + :paramtype blob_types: list[str] + :keyword include_blob_versions: Includes blob versions in blob inventory when value is set to + true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this + property is set to true, else they must be excluded. + :paramtype include_blob_versions: bool + :keyword include_snapshots: Includes blob snapshots in blob inventory when value is set to + true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, + else it must be excluded. + :paramtype include_snapshots: bool + """ + super(BlobInventoryPolicyFilter, self).__init__(**kwargs) + self.prefix_match = prefix_match + self.blob_types = blob_types + self.include_blob_versions = include_blob_versions + self.include_snapshots = include_snapshots + + +class BlobInventoryPolicyRule(msrest.serialization.Model): + """An object that wraps the blob inventory rule. Each rule is uniquely defined by name. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Required. Rule is enabled when set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :vartype destination: str + :ivar definition: Required. An object that defines the blob inventory policy rule. + :vartype definition: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyDefinition + """ + + _validation = { + 'enabled': {'required': True}, + 'name': {'required': True}, + 'destination': {'required': True}, + 'definition': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'str'}, + 'definition': {'key': 'definition', 'type': 'BlobInventoryPolicyDefinition'}, + } + + def __init__( + self, + *, + enabled: bool, + name: str, + destination: str, + definition: "BlobInventoryPolicyDefinition", + **kwargs + ): + """ + :keyword enabled: Required. Rule is enabled when set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword destination: Required. Container name where blob inventory files are stored. Must be + pre-created. + :paramtype destination: str + :keyword definition: Required. An object that defines the blob inventory policy rule. + :paramtype definition: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyDefinition + """ + super(BlobInventoryPolicyRule, self).__init__(**kwargs) + self.enabled = enabled + self.name = name + self.destination = destination + self.definition = definition + + +class BlobInventoryPolicySchema(msrest.serialization.Model): + """The storage account blob inventory policy rules. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Required. Policy is enabled if set to true. + :vartype enabled: bool + :ivar type: Required. The valid value is Inventory. Possible values include: "Inventory". + :vartype type: str or ~azure.mgmt.storage.v2021_08_01.models.InventoryRuleType + :ivar rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :vartype rules: list[~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyRule] + """ + + _validation = { + 'enabled': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[BlobInventoryPolicyRule]'}, + } + + def __init__( + self, + *, + enabled: bool, + type: Union[str, "InventoryRuleType"], + rules: List["BlobInventoryPolicyRule"], + **kwargs + ): + """ + :keyword enabled: Required. Policy is enabled if set to true. + :paramtype enabled: bool + :keyword type: Required. The valid value is Inventory. Possible values include: "Inventory". + :paramtype type: str or ~azure.mgmt.storage.v2021_08_01.models.InventoryRuleType + :keyword rules: Required. The storage account blob inventory policy rules. The rule is applied + when it is enabled. + :paramtype rules: list[~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyRule] + """ + super(BlobInventoryPolicySchema, self).__init__(**kwargs) + self.enabled = enabled + self.type = type + self.rules = rules + + +class BlobRestoreParameters(msrest.serialization.Model): + """Blob restore parameters. + + All required parameters must be populated in order to send to Azure. + + :ivar time_to_restore: Required. Restore blob to the specified time. + :vartype time_to_restore: ~datetime.datetime + :ivar blob_ranges: Required. Blob ranges to restore. + :vartype blob_ranges: list[~azure.mgmt.storage.v2021_08_01.models.BlobRestoreRange] + """ + + _validation = { + 'time_to_restore': {'required': True}, + 'blob_ranges': {'required': True}, + } + + _attribute_map = { + 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, + 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, + } + + def __init__( + self, + *, + time_to_restore: datetime.datetime, + blob_ranges: List["BlobRestoreRange"], + **kwargs + ): + """ + :keyword time_to_restore: Required. Restore blob to the specified time. + :paramtype time_to_restore: ~datetime.datetime + :keyword blob_ranges: Required. Blob ranges to restore. + :paramtype blob_ranges: list[~azure.mgmt.storage.v2021_08_01.models.BlobRestoreRange] + """ + super(BlobRestoreParameters, self).__init__(**kwargs) + self.time_to_restore = time_to_restore + self.blob_ranges = blob_ranges + + +class BlobRestoreRange(msrest.serialization.Model): + """Blob range. + + All required parameters must be populated in order to send to Azure. + + :ivar start_range: Required. Blob start range. This is inclusive. Empty means account start. + :vartype start_range: str + :ivar end_range: Required. Blob end range. This is exclusive. Empty means account end. + :vartype end_range: str + """ + + _validation = { + 'start_range': {'required': True}, + 'end_range': {'required': True}, + } + + _attribute_map = { + 'start_range': {'key': 'startRange', 'type': 'str'}, + 'end_range': {'key': 'endRange', 'type': 'str'}, + } + + def __init__( + self, + *, + start_range: str, + end_range: str, + **kwargs + ): + """ + :keyword start_range: Required. Blob start range. This is inclusive. Empty means account start. + :paramtype start_range: str + :keyword end_range: Required. Blob end range. This is exclusive. Empty means account end. + :paramtype end_range: str + """ + super(BlobRestoreRange, self).__init__(**kwargs) + self.start_range = start_range + self.end_range = end_range + + +class BlobRestoreStatus(msrest.serialization.Model): + """Blob restore status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of blob restore progress. Possible values are: - InProgress: Indicates + that blob restore is ongoing. - Complete: Indicates that blob restore has been completed + successfully. - Failed: Indicates that blob restore is failed. Possible values include: + "InProgress", "Complete", "Failed". + :vartype status: str or ~azure.mgmt.storage.v2021_08_01.models.BlobRestoreProgressStatus + :ivar failure_reason: Failure reason when blob restore is failed. + :vartype failure_reason: str + :ivar restore_id: Id for tracking blob restore request. + :vartype restore_id: str + :ivar parameters: Blob restore request parameters. + :vartype parameters: ~azure.mgmt.storage.v2021_08_01.models.BlobRestoreParameters + """ + + _validation = { + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'restore_id': {'readonly': True}, + 'parameters': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'restore_id': {'key': 'restoreId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BlobRestoreStatus, self).__init__(**kwargs) + self.status = None + self.failure_reason = None + self.restore_id = None + self.parameters = None + + +class BlobServiceItems(msrest.serialization.Model): + """BlobServiceItems. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of blob services returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BlobServiceProperties]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BlobServiceItems, self).__init__(**kwargs) + self.value = None + + +class BlobServiceProperties(Resource): + """The properties of a storage account’s Blob service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar sku: Sku name and tier. + :vartype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :ivar cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :vartype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + :ivar default_service_version: DefaultServiceVersion indicates the default version to use for + requests to the Blob service if an incoming request’s version is not specified. Possible values + include version 2008-10-27 and all more recent versions. + :vartype default_service_version: str + :ivar delete_retention_policy: The blob service properties for blob soft delete. + :vartype delete_retention_policy: ~azure.mgmt.storage.v2021_08_01.models.DeleteRetentionPolicy + :ivar is_versioning_enabled: Versioning is enabled if set to true. + :vartype is_versioning_enabled: bool + :ivar automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled property. + :vartype automatic_snapshot_policy_enabled: bool + :ivar change_feed: The blob service properties for change feed events. + :vartype change_feed: ~azure.mgmt.storage.v2021_08_01.models.ChangeFeed + :ivar restore_policy: The blob service properties for blob restore policy. + :vartype restore_policy: ~azure.mgmt.storage.v2021_08_01.models.RestorePolicyProperties + :ivar container_delete_retention_policy: The blob service properties for container soft delete. + :vartype container_delete_retention_policy: + ~azure.mgmt.storage.v2021_08_01.models.DeleteRetentionPolicy + :ivar last_access_time_tracking_policy: The blob service property to configure last access time + based tracking policy. + :vartype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2021_08_01.models.LastAccessTimeTrackingPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, + 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, + 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, + 'is_versioning_enabled': {'key': 'properties.isVersioningEnabled', 'type': 'bool'}, + 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, + 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, + 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, + 'container_delete_retention_policy': {'key': 'properties.containerDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, + 'last_access_time_tracking_policy': {'key': 'properties.lastAccessTimeTrackingPolicy', 'type': 'LastAccessTimeTrackingPolicy'}, + } + + def __init__( + self, + *, + cors: Optional["CorsRules"] = None, + default_service_version: Optional[str] = None, + delete_retention_policy: Optional["DeleteRetentionPolicy"] = None, + is_versioning_enabled: Optional[bool] = None, + automatic_snapshot_policy_enabled: Optional[bool] = None, + change_feed: Optional["ChangeFeed"] = None, + restore_policy: Optional["RestorePolicyProperties"] = None, + container_delete_retention_policy: Optional["DeleteRetentionPolicy"] = None, + last_access_time_tracking_policy: Optional["LastAccessTimeTrackingPolicy"] = None, + **kwargs + ): + """ + :keyword cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :paramtype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + :keyword default_service_version: DefaultServiceVersion indicates the default version to use + for requests to the Blob service if an incoming request’s version is not specified. Possible + values include version 2008-10-27 and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: The blob service properties for blob soft delete. + :paramtype delete_retention_policy: + ~azure.mgmt.storage.v2021_08_01.models.DeleteRetentionPolicy + :keyword is_versioning_enabled: Versioning is enabled if set to true. + :paramtype is_versioning_enabled: bool + :keyword automatic_snapshot_policy_enabled: Deprecated in favor of isVersioningEnabled + property. + :paramtype automatic_snapshot_policy_enabled: bool + :keyword change_feed: The blob service properties for change feed events. + :paramtype change_feed: ~azure.mgmt.storage.v2021_08_01.models.ChangeFeed + :keyword restore_policy: The blob service properties for blob restore policy. + :paramtype restore_policy: ~azure.mgmt.storage.v2021_08_01.models.RestorePolicyProperties + :keyword container_delete_retention_policy: The blob service properties for container soft + delete. + :paramtype container_delete_retention_policy: + ~azure.mgmt.storage.v2021_08_01.models.DeleteRetentionPolicy + :keyword last_access_time_tracking_policy: The blob service property to configure last access + time based tracking policy. + :paramtype last_access_time_tracking_policy: + ~azure.mgmt.storage.v2021_08_01.models.LastAccessTimeTrackingPolicy + """ + super(BlobServiceProperties, self).__init__(**kwargs) + self.sku = None + self.cors = cors + self.default_service_version = default_service_version + self.delete_retention_policy = delete_retention_policy + self.is_versioning_enabled = is_versioning_enabled + self.automatic_snapshot_policy_enabled = automatic_snapshot_policy_enabled + self.change_feed = change_feed + self.restore_policy = restore_policy + self.container_delete_retention_policy = container_delete_retention_policy + self.last_access_time_tracking_policy = last_access_time_tracking_policy + + +class ChangeFeed(msrest.serialization.Model): + """The blob service properties for change feed events. + + :ivar enabled: Indicates whether change feed event logging is enabled for the Blob service. + :vartype enabled: bool + :ivar retention_in_days: Indicates the duration of changeFeed retention in days. Minimum value + is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :vartype retention_in_days: int + """ + + _validation = { + 'retention_in_days': {'maximum': 146000, 'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_in_days': {'key': 'retentionInDays', 'type': 'int'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + retention_in_days: Optional[int] = None, + **kwargs + ): + """ + :keyword enabled: Indicates whether change feed event logging is enabled for the Blob service. + :paramtype enabled: bool + :keyword retention_in_days: Indicates the duration of changeFeed retention in days. Minimum + value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite + retention of the change feed. + :paramtype retention_in_days: int + """ + super(ChangeFeed, self).__init__(**kwargs) + self.enabled = enabled + self.retention_in_days = retention_in_days + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: Gets a boolean value that indicates whether the name is available for you + to use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. + :vartype name_available: bool + :ivar reason: Gets the reason that a storage account name could not be used. The Reason element + is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.storage.v2021_08_01.models.Reason + :ivar message: Gets an error message explaining the Reason value in more detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudErrorAutoGenerated(msrest.serialization.Model): + """An error response from the Storage service. + + :ivar error: An error response from the Storage service. + :vartype error: ~azure.mgmt.storage.v2021_08_01.models.CloudErrorBodyAutoGenerated + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBodyAutoGenerated'}, + } + + def __init__( + self, + *, + error: Optional["CloudErrorBodyAutoGenerated"] = None, + **kwargs + ): + """ + :keyword error: An error response from the Storage service. + :paramtype error: ~azure.mgmt.storage.v2021_08_01.models.CloudErrorBodyAutoGenerated + """ + super(CloudErrorAutoGenerated, self).__init__(**kwargs) + self.error = error + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the Storage service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_08_01.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_08_01.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class CloudErrorBodyAutoGenerated(msrest.serialization.Model): + """An error response from the Storage service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.storage.v2021_08_01.models.CloudErrorBodyAutoGenerated] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBodyAutoGenerated]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBodyAutoGenerated"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.storage.v2021_08_01.models.CloudErrorBodyAutoGenerated] + """ + super(CloudErrorBodyAutoGenerated, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class CorsRule(msrest.serialization.Model): + """Specifies a CORS rule for the Blob service. + + All required parameters must be populated in order to send to Azure. + + :ivar allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :vartype allowed_origins: list[str] + :ivar allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :vartype allowed_methods: list[str or + ~azure.mgmt.storage.v2021_08_01.models.CorsRuleAllowedMethodsItem] + :ivar max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :vartype max_age_in_seconds: int + :ivar exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :vartype exposed_headers: list[str] + :ivar allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :vartype allowed_headers: list[str] + """ + + _validation = { + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'max_age_in_seconds': {'required': True}, + 'exposed_headers': {'required': True}, + 'allowed_headers': {'required': True}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, + 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, + 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, + 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_origins: List[str], + allowed_methods: List[Union[str, "CorsRuleAllowedMethodsItem"]], + max_age_in_seconds: int, + exposed_headers: List[str], + allowed_headers: List[str], + **kwargs + ): + """ + :keyword allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Required. Required if CorsRule element is present. A list of HTTP + methods that are allowed to be executed by the origin. + :paramtype allowed_methods: list[str or + ~azure.mgmt.storage.v2021_08_01.models.CorsRuleAllowedMethodsItem] + :keyword max_age_in_seconds: Required. Required if CorsRule element is present. The number of + seconds that the client/browser should cache a preflight response. + :paramtype max_age_in_seconds: int + :keyword exposed_headers: Required. Required if CorsRule element is present. A list of response + headers to expose to CORS clients. + :paramtype exposed_headers: list[str] + :keyword allowed_headers: Required. Required if CorsRule element is present. A list of headers + allowed to be part of the cross-origin request. + :paramtype allowed_headers: list[str] + """ + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_methods = allowed_methods + self.max_age_in_seconds = max_age_in_seconds + self.exposed_headers = exposed_headers + self.allowed_headers = allowed_headers + + +class CorsRules(msrest.serialization.Model): + """Sets the CORS rules. You can include up to five CorsRule elements in the request. + + :ivar cors_rules: The List of CORS rules. You can include up to five CorsRule elements in the + request. + :vartype cors_rules: list[~azure.mgmt.storage.v2021_08_01.models.CorsRule] + """ + + _attribute_map = { + 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, + } + + def __init__( + self, + *, + cors_rules: Optional[List["CorsRule"]] = None, + **kwargs + ): + """ + :keyword cors_rules: The List of CORS rules. You can include up to five CorsRule elements in + the request. + :paramtype cors_rules: list[~azure.mgmt.storage.v2021_08_01.models.CorsRule] + """ + super(CorsRules, self).__init__(**kwargs) + self.cors_rules = cors_rules + + +class CustomDomain(msrest.serialization.Model): + """The custom domain assigned to this storage account. This can be set via Update. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Gets or sets the custom domain name assigned to the storage account. Name + is the CNAME source. + :vartype name: str + :ivar use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :vartype use_sub_domain_name: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + use_sub_domain_name: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Required. Gets or sets the custom domain name assigned to the storage account. + Name is the CNAME source. + :paramtype name: str + :keyword use_sub_domain_name: Indicates whether indirect CName validation is enabled. Default + value is false. This should only be set on updates. + :paramtype use_sub_domain_name: bool + """ + super(CustomDomain, self).__init__(**kwargs) + self.name = name + self.use_sub_domain_name = use_sub_domain_name + + +class DateAfterCreation(msrest.serialization.Model): + """Object to define the number of days after creation. + + All required parameters must be populated in order to send to Azure. + + :ivar days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :vartype days_after_creation_greater_than: float + """ + + _validation = { + 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, + } + + _attribute_map = { + 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, + } + + def __init__( + self, + *, + days_after_creation_greater_than: float, + **kwargs + ): + """ + :keyword days_after_creation_greater_than: Required. Value indicating the age in days after + creation. + :paramtype days_after_creation_greater_than: float + """ + super(DateAfterCreation, self).__init__(**kwargs) + self.days_after_creation_greater_than = days_after_creation_greater_than + + +class DateAfterModification(msrest.serialization.Model): + """Object to define the number of days after object last modification Or last access. Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually exclusive. + + :ivar days_after_modification_greater_than: Value indicating the age in days after last + modification. + :vartype days_after_modification_greater_than: float + :ivar days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :vartype days_after_last_access_time_greater_than: float + """ + + _validation = { + 'days_after_modification_greater_than': {'minimum': 0, 'multiple': 1}, + 'days_after_last_access_time_greater_than': {'minimum': 0, 'multiple': 1}, + } + + _attribute_map = { + 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, + 'days_after_last_access_time_greater_than': {'key': 'daysAfterLastAccessTimeGreaterThan', 'type': 'float'}, + } + + def __init__( + self, + *, + days_after_modification_greater_than: Optional[float] = None, + days_after_last_access_time_greater_than: Optional[float] = None, + **kwargs + ): + """ + :keyword days_after_modification_greater_than: Value indicating the age in days after last + modification. + :paramtype days_after_modification_greater_than: float + :keyword days_after_last_access_time_greater_than: Value indicating the age in days after last + blob access. This property can only be used in conjunction with last access time tracking + policy. + :paramtype days_after_last_access_time_greater_than: float + """ + super(DateAfterModification, self).__init__(**kwargs) + self.days_after_modification_greater_than = days_after_modification_greater_than + self.days_after_last_access_time_greater_than = days_after_last_access_time_greater_than + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class DeletedAccount(ProxyResource): + """Deleted storage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar storage_account_resource_id: Full resource id of the original storage account. + :vartype storage_account_resource_id: str + :ivar location: Location of the deleted account. + :vartype location: str + :ivar restore_reference: Can be used to attempt recovering this deleted account via + PutStorageAccount API. + :vartype restore_reference: str + :ivar creation_time: Creation time of the deleted account. + :vartype creation_time: str + :ivar deletion_time: Deletion time of the deleted account. + :vartype deletion_time: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'storage_account_resource_id': {'readonly': True}, + 'location': {'readonly': True}, + 'restore_reference': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'deletion_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'location': {'key': 'properties.location', 'type': 'str'}, + 'restore_reference': {'key': 'properties.restoreReference', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'deletion_time': {'key': 'properties.deletionTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeletedAccount, self).__init__(**kwargs) + self.storage_account_resource_id = None + self.location = None + self.restore_reference = None + self.creation_time = None + self.deletion_time = None + + +class DeletedAccountListResult(msrest.serialization.Model): + """The response from the List Deleted Accounts operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Gets the list of deleted accounts and their properties. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.DeletedAccount] + :ivar next_link: Request URL that can be used to query next page of deleted accounts. Returned + when total number of requested deleted accounts exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeletedAccountListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class DeletedShare(msrest.serialization.Model): + """The deleted share to be restored. + + All required parameters must be populated in order to send to Azure. + + :ivar deleted_share_name: Required. Required. Identify the name of the deleted share that will + be restored. + :vartype deleted_share_name: str + :ivar deleted_share_version: Required. Required. Identify the version of the deleted share that + will be restored. + :vartype deleted_share_version: str + """ + + _validation = { + 'deleted_share_name': {'required': True}, + 'deleted_share_version': {'required': True}, + } + + _attribute_map = { + 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, + 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + deleted_share_name: str, + deleted_share_version: str, + **kwargs + ): + """ + :keyword deleted_share_name: Required. Required. Identify the name of the deleted share that + will be restored. + :paramtype deleted_share_name: str + :keyword deleted_share_version: Required. Required. Identify the version of the deleted share + that will be restored. + :paramtype deleted_share_version: str + """ + super(DeletedShare, self).__init__(**kwargs) + self.deleted_share_name = deleted_share_name + self.deleted_share_version = deleted_share_version + + +class DeleteRetentionPolicy(msrest.serialization.Model): + """The service properties for soft delete. + + :ivar enabled: Indicates whether DeleteRetentionPolicy is enabled. + :vartype enabled: bool + :ivar days: Indicates the number of days that the deleted item should be retained. The minimum + specified value can be 1 and the maximum value can be 365. + :vartype days: int + """ + + _validation = { + 'days': {'maximum': 365, 'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + days: Optional[int] = None, + **kwargs + ): + """ + :keyword enabled: Indicates whether DeleteRetentionPolicy is enabled. + :paramtype enabled: bool + :keyword days: Indicates the number of days that the deleted item should be retained. The + minimum specified value can be 1 and the maximum value can be 365. + :paramtype days: int + """ + super(DeleteRetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class Dimension(msrest.serialization.Model): + """Dimension of blobs, possibly be blob type or access tier. + + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ + super(Dimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + +class Encryption(msrest.serialization.Model): + """The encryption settings on the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar services: List of services which support encryption. + :vartype services: ~azure.mgmt.storage.v2021_08_01.models.EncryptionServices + :ivar key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :vartype key_source: str or ~azure.mgmt.storage.v2021_08_01.models.KeySource + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :vartype require_infrastructure_encryption: bool + :ivar key_vault_properties: Properties provided by key vault. + :vartype key_vault_properties: ~azure.mgmt.storage.v2021_08_01.models.KeyVaultProperties + :ivar encryption_identity: The identity to be used with service-side encryption at rest. + :vartype encryption_identity: ~azure.mgmt.storage.v2021_08_01.models.EncryptionIdentity + """ + + _validation = { + 'key_source': {'required': True}, + } + + _attribute_map = { + 'services': {'key': 'services', 'type': 'EncryptionServices'}, + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + 'key_vault_properties': {'key': 'keyvaultproperties', 'type': 'KeyVaultProperties'}, + 'encryption_identity': {'key': 'identity', 'type': 'EncryptionIdentity'}, + } + + def __init__( + self, + *, + key_source: Union[str, "KeySource"] = "Microsoft.Storage", + services: Optional["EncryptionServices"] = None, + require_infrastructure_encryption: Optional[bool] = None, + key_vault_properties: Optional["KeyVaultProperties"] = None, + encryption_identity: Optional["EncryptionIdentity"] = None, + **kwargs + ): + """ + :keyword services: List of services which support encryption. + :paramtype services: ~azure.mgmt.storage.v2021_08_01.models.EncryptionServices + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: + "Microsoft.Storage", "Microsoft.Keyvault". Default value: "Microsoft.Storage". + :paramtype key_source: str or ~azure.mgmt.storage.v2021_08_01.models.KeySource + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + :keyword key_vault_properties: Properties provided by key vault. + :paramtype key_vault_properties: ~azure.mgmt.storage.v2021_08_01.models.KeyVaultProperties + :keyword encryption_identity: The identity to be used with service-side encryption at rest. + :paramtype encryption_identity: ~azure.mgmt.storage.v2021_08_01.models.EncryptionIdentity + """ + super(Encryption, self).__init__(**kwargs) + self.services = services + self.key_source = key_source + self.require_infrastructure_encryption = require_infrastructure_encryption + self.key_vault_properties = key_vault_properties + self.encryption_identity = encryption_identity + + +class EncryptionIdentity(msrest.serialization.Model): + """Encryption identity for the storage account. + + :ivar encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to be + associated with server-side encryption on the storage account. + :vartype encryption_user_assigned_identity: str + :ivar encryption_federated_identity_client_id: ClientId of the multi-tenant application to be + used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys + server-side encryption on the storage account. + :vartype encryption_federated_identity_client_id: str + """ + + _attribute_map = { + 'encryption_user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + 'encryption_federated_identity_client_id': {'key': 'federatedIdentityClientId', 'type': 'str'}, + } + + def __init__( + self, + *, + encryption_user_assigned_identity: Optional[str] = None, + encryption_federated_identity_client_id: Optional[str] = None, + **kwargs + ): + """ + :keyword encryption_user_assigned_identity: Resource identifier of the UserAssigned identity to + be associated with server-side encryption on the storage account. + :paramtype encryption_user_assigned_identity: str + :keyword encryption_federated_identity_client_id: ClientId of the multi-tenant application to + be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys + server-side encryption on the storage account. + :paramtype encryption_federated_identity_client_id: str + """ + super(EncryptionIdentity, self).__init__(**kwargs) + self.encryption_user_assigned_identity = encryption_user_assigned_identity + self.encryption_federated_identity_client_id = encryption_federated_identity_client_id + + +class EncryptionScope(Resource): + """The Encryption Scope resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :vartype source: str or ~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeSource + :ivar state: The state of the encryption scope. Possible values (case-insensitive): Enabled, + Disabled. Possible values include: "Enabled", "Disabled". + :vartype state: str or ~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeState + :ivar creation_time: Gets the creation date and time of the encryption scope in UTC. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets the last modification date and time of the encryption scope in + UTC. + :vartype last_modified_time: ~datetime.datetime + :ivar key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :vartype key_vault_properties: + ~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeKeyVaultProperties + :ivar require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :vartype require_infrastructure_encryption: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'EncryptionScopeKeyVaultProperties'}, + 'require_infrastructure_encryption': {'key': 'properties.requireInfrastructureEncryption', 'type': 'bool'}, + } + + def __init__( + self, + *, + source: Optional[Union[str, "EncryptionScopeSource"]] = None, + state: Optional[Union[str, "EncryptionScopeState"]] = None, + key_vault_properties: Optional["EncryptionScopeKeyVaultProperties"] = None, + require_infrastructure_encryption: Optional[bool] = None, + **kwargs + ): + """ + :keyword source: The provider for the encryption scope. Possible values (case-insensitive): + Microsoft.Storage, Microsoft.KeyVault. Possible values include: "Microsoft.Storage", + "Microsoft.KeyVault". + :paramtype source: str or ~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeSource + :keyword state: The state of the encryption scope. Possible values (case-insensitive): + Enabled, Disabled. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeState + :keyword key_vault_properties: The key vault properties for the encryption scope. This is a + required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + :paramtype key_vault_properties: + ~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeKeyVaultProperties + :keyword require_infrastructure_encryption: A boolean indicating whether or not the service + applies a secondary layer of encryption with platform managed keys for data at rest. + :paramtype require_infrastructure_encryption: bool + """ + super(EncryptionScope, self).__init__(**kwargs) + self.source = source + self.state = state + self.creation_time = None + self.last_modified_time = None + self.key_vault_properties = key_vault_properties + self.require_infrastructure_encryption = require_infrastructure_encryption + + +class EncryptionScopeKeyVaultProperties(msrest.serialization.Model): + """The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key_uri: The object identifier for a key vault key object. When applied, the encryption + scope will use the key referenced by the identifier to enable customer-managed key support on + this encryption scope. + :vartype key_uri: str + :ivar current_versioned_key_identifier: The object identifier of the current versioned Key + Vault Key in use. + :vartype current_versioned_key_identifier: str + :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. + :vartype last_key_rotation_timestamp: ~datetime.datetime + """ + + _validation = { + 'current_versioned_key_identifier': {'readonly': True}, + 'last_key_rotation_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, + 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + key_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword key_uri: The object identifier for a key vault key object. When applied, the + encryption scope will use the key referenced by the identifier to enable customer-managed key + support on this encryption scope. + :paramtype key_uri: str + """ + super(EncryptionScopeKeyVaultProperties, self).__init__(**kwargs) + self.key_uri = key_uri + self.current_versioned_key_identifier = None + self.last_key_rotation_timestamp = None + + +class EncryptionScopeListResult(msrest.serialization.Model): + """List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of encryption scopes requested. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.EncryptionScope] + :ivar next_link: Request URL that can be used to query next page of encryption scopes. Returned + when total number of requested encryption scopes exceeds the maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EncryptionScope]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(EncryptionScopeListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class EncryptionService(msrest.serialization.Model): + """A service that allows server-side encryption to be used. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. Encryption at rest is enabled by default today and cannot be disabled. + :vartype enabled: bool + :ivar last_enabled_time: Gets a rough estimate of the date/time when the encryption was last + enabled by the user. Data is encrypted at rest by default today and cannot be disabled. + :vartype last_enabled_time: ~datetime.datetime + :ivar key_type: Encryption key type to be used for the encryption service. 'Account' key type + implies that an account-scoped encryption key will be used. 'Service' key type implies that a + default service key is used. Possible values include: "Service", "Account". + :vartype key_type: str or ~azure.mgmt.storage.v2021_08_01.models.KeyType + """ + + _validation = { + 'last_enabled_time': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + key_type: Optional[Union[str, "KeyType"]] = None, + **kwargs + ): + """ + :keyword enabled: A boolean indicating whether or not the service encrypts the data as it is + stored. Encryption at rest is enabled by default today and cannot be disabled. + :paramtype enabled: bool + :keyword key_type: Encryption key type to be used for the encryption service. 'Account' key + type implies that an account-scoped encryption key will be used. 'Service' key type implies + that a default service key is used. Possible values include: "Service", "Account". + :paramtype key_type: str or ~azure.mgmt.storage.v2021_08_01.models.KeyType + """ + super(EncryptionService, self).__init__(**kwargs) + self.enabled = enabled + self.last_enabled_time = None + self.key_type = key_type + + +class EncryptionServices(msrest.serialization.Model): + """A list of services that support encryption. + + :ivar blob: The encryption function of the blob storage service. + :vartype blob: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + :ivar file: The encryption function of the file storage service. + :vartype file: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + :ivar table: The encryption function of the table storage service. + :vartype table: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + :ivar queue: The encryption function of the queue storage service. + :vartype queue: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + """ + + _attribute_map = { + 'blob': {'key': 'blob', 'type': 'EncryptionService'}, + 'file': {'key': 'file', 'type': 'EncryptionService'}, + 'table': {'key': 'table', 'type': 'EncryptionService'}, + 'queue': {'key': 'queue', 'type': 'EncryptionService'}, + } + + def __init__( + self, + *, + blob: Optional["EncryptionService"] = None, + file: Optional["EncryptionService"] = None, + table: Optional["EncryptionService"] = None, + queue: Optional["EncryptionService"] = None, + **kwargs + ): + """ + :keyword blob: The encryption function of the blob storage service. + :paramtype blob: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + :keyword file: The encryption function of the file storage service. + :paramtype file: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + :keyword table: The encryption function of the table storage service. + :paramtype table: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + :keyword queue: The encryption function of the queue storage service. + :paramtype queue: ~azure.mgmt.storage.v2021_08_01.models.EncryptionService + """ + super(EncryptionServices, self).__init__(**kwargs) + self.blob = blob + self.file = file + self.table = table + self.queue = queue + + +class Endpoints(msrest.serialization.Model): + """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar blob: Gets the blob endpoint. + :vartype blob: str + :ivar queue: Gets the queue endpoint. + :vartype queue: str + :ivar table: Gets the table endpoint. + :vartype table: str + :ivar file: Gets the file endpoint. + :vartype file: str + :ivar web: Gets the web endpoint. + :vartype web: str + :ivar dfs: Gets the dfs endpoint. + :vartype dfs: str + :ivar microsoft_endpoints: Gets the microsoft routing storage endpoints. + :vartype microsoft_endpoints: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountMicrosoftEndpoints + :ivar internet_endpoints: Gets the internet routing storage endpoints. + :vartype internet_endpoints: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountInternetEndpoints + """ + + _validation = { + 'blob': {'readonly': True}, + 'queue': {'readonly': True}, + 'table': {'readonly': True}, + 'file': {'readonly': True}, + 'web': {'readonly': True}, + 'dfs': {'readonly': True}, + } + + _attribute_map = { + 'blob': {'key': 'blob', 'type': 'str'}, + 'queue': {'key': 'queue', 'type': 'str'}, + 'table': {'key': 'table', 'type': 'str'}, + 'file': {'key': 'file', 'type': 'str'}, + 'web': {'key': 'web', 'type': 'str'}, + 'dfs': {'key': 'dfs', 'type': 'str'}, + 'microsoft_endpoints': {'key': 'microsoftEndpoints', 'type': 'StorageAccountMicrosoftEndpoints'}, + 'internet_endpoints': {'key': 'internetEndpoints', 'type': 'StorageAccountInternetEndpoints'}, + } + + def __init__( + self, + *, + microsoft_endpoints: Optional["StorageAccountMicrosoftEndpoints"] = None, + internet_endpoints: Optional["StorageAccountInternetEndpoints"] = None, + **kwargs + ): + """ + :keyword microsoft_endpoints: Gets the microsoft routing storage endpoints. + :paramtype microsoft_endpoints: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountMicrosoftEndpoints + :keyword internet_endpoints: Gets the internet routing storage endpoints. + :paramtype internet_endpoints: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountInternetEndpoints + """ + super(Endpoints, self).__init__(**kwargs) + self.blob = None + self.queue = None + self.table = None + self.file = None + self.web = None + self.dfs = None + self.microsoft_endpoints = microsoft_endpoints + self.internet_endpoints = internet_endpoints + + +class ErrorResponse(msrest.serialization.Model): + """An error response from the storage resource provider. + + :ivar error: Azure Storage Resource Provider error response body. + :vartype error: ~azure.mgmt.storage.v2021_08_01.models.ErrorResponseBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseBody"] = None, + **kwargs + ): + """ + :keyword error: Azure Storage Resource Provider error response body. + :paramtype error: ~azure.mgmt.storage.v2021_08_01.models.ErrorResponseBody + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseBody(msrest.serialization.Model): + """Error response body contract. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.storage.v2021_08_01.models.ExtendedLocationTypes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + **kwargs + ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :paramtype type: str or ~azure.mgmt.storage.v2021_08_01.models.ExtendedLocationTypes + """ + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +class FileServiceItems(msrest.serialization.Model): + """FileServiceItems. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of file services returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FileServiceItems, self).__init__(**kwargs) + self.value = None + + +class FileServiceProperties(Resource): + """The properties of File services in storage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar sku: Sku name and tier. + :vartype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :ivar cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :vartype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + :ivar share_delete_retention_policy: The file service properties for share soft delete. + :vartype share_delete_retention_policy: + ~azure.mgmt.storage.v2021_08_01.models.DeleteRetentionPolicy + :ivar protocol_settings: Protocol settings for file service. + :vartype protocol_settings: ~azure.mgmt.storage.v2021_08_01.models.ProtocolSettings + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, + 'share_delete_retention_policy': {'key': 'properties.shareDeleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, + 'protocol_settings': {'key': 'properties.protocolSettings', 'type': 'ProtocolSettings'}, + } + + def __init__( + self, + *, + cors: Optional["CorsRules"] = None, + share_delete_retention_policy: Optional["DeleteRetentionPolicy"] = None, + protocol_settings: Optional["ProtocolSettings"] = None, + **kwargs + ): + """ + :keyword cors: Specifies CORS rules for the File service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the File service. + :paramtype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + :keyword share_delete_retention_policy: The file service properties for share soft delete. + :paramtype share_delete_retention_policy: + ~azure.mgmt.storage.v2021_08_01.models.DeleteRetentionPolicy + :keyword protocol_settings: Protocol settings for file service. + :paramtype protocol_settings: ~azure.mgmt.storage.v2021_08_01.models.ProtocolSettings + """ + super(FileServiceProperties, self).__init__(**kwargs) + self.sku = None + self.cors = cors + self.share_delete_retention_policy = share_delete_retention_policy + self.protocol_settings = protocol_settings + + +class FileShare(AzureEntityResource): + """Properties of the file share, including Id, resource name, resource type, Etag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar last_modified_time: Returns the date and time the share was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only + be specified when creating a share. Possible values include: "SMB", "NFS". + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_08_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :vartype root_squash: str or ~azure.mgmt.storage.v2021_08_01.models.RootSquashType + :ivar version: The version of the share. + :vartype version: str + :ivar deleted: Indicates whether the share was deleted. + :vartype deleted: bool + :ivar deleted_time: The deleted time if the share was deleted. + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. + :vartype remaining_retention_days: int + :ivar access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.ShareAccessTier + :ivar access_tier_change_time: Indicates the last modification time for share access tier. + :vartype access_tier_change_time: ~datetime.datetime + :ivar access_tier_status: Indicates if there is a pending transition for access tier. + :vartype access_tier_status: str + :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this + value may not include all recently created or recently resized files. + :vartype share_usage_bytes: long + :ivar lease_status: The lease status of the share. Possible values include: "Locked", + "Unlocked". + :vartype lease_status: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseStatus + :ivar lease_state: Lease state of the share. Possible values include: "Available", "Leased", + "Expired", "Breaking", "Broken". + :vartype lease_state: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseState + :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, + only when the share is leased. Possible values include: "Infinite", "Fixed". + :vartype lease_duration: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseDuration + :ivar signed_identifiers: List of stored access policies specified on the share. + :vartype signed_identifiers: list[~azure.mgmt.storage.v2021_08_01.models.SignedIdentifier] + :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares + with expand param "snapshots". + :vartype snapshot_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'access_tier_change_time': {'readonly': True}, + 'access_tier_status': {'readonly': True}, + 'share_usage_bytes': {'readonly': True}, + 'lease_status': {'readonly': True}, + 'lease_state': {'readonly': True}, + 'lease_duration': {'readonly': True}, + 'snapshot_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, + 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, + 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, + 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, + 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, + 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, + 'signed_identifiers': {'key': 'properties.signedIdentifiers', 'type': '[SignedIdentifier]'}, + 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + share_quota: Optional[int] = None, + enabled_protocols: Optional[Union[str, "EnabledProtocols"]] = None, + root_squash: Optional[Union[str, "RootSquashType"]] = None, + access_tier: Optional[Union[str, "ShareAccessTier"]] = None, + signed_identifiers: Optional[List["SignedIdentifier"]] = None, + **kwargs + ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_08_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_08_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.ShareAccessTier + :keyword signed_identifiers: List of stored access policies specified on the share. + :paramtype signed_identifiers: list[~azure.mgmt.storage.v2021_08_01.models.SignedIdentifier] + """ + super(FileShare, self).__init__(**kwargs) + self.last_modified_time = None + self.metadata = metadata + self.share_quota = share_quota + self.enabled_protocols = enabled_protocols + self.root_squash = root_squash + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.access_tier = access_tier + self.access_tier_change_time = None + self.access_tier_status = None + self.share_usage_bytes = None + self.lease_status = None + self.lease_state = None + self.lease_duration = None + self.signed_identifiers = signed_identifiers + self.snapshot_time = None + + +class FileShareItem(AzureEntityResource): + """The file share properties be listed out. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar last_modified_time: Returns the date and time the share was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar metadata: A name-value pair to associate with the share as metadata. + :vartype metadata: dict[str, str] + :ivar share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :vartype share_quota: int + :ivar enabled_protocols: The authentication protocol that is used for the file share. Can only + be specified when creating a share. Possible values include: "SMB", "NFS". + :vartype enabled_protocols: str or ~azure.mgmt.storage.v2021_08_01.models.EnabledProtocols + :ivar root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :vartype root_squash: str or ~azure.mgmt.storage.v2021_08_01.models.RootSquashType + :ivar version: The version of the share. + :vartype version: str + :ivar deleted: Indicates whether the share was deleted. + :vartype deleted: bool + :ivar deleted_time: The deleted time if the share was deleted. + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: Remaining retention days for share that was soft deleted. + :vartype remaining_retention_days: int + :ivar access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.ShareAccessTier + :ivar access_tier_change_time: Indicates the last modification time for share access tier. + :vartype access_tier_change_time: ~datetime.datetime + :ivar access_tier_status: Indicates if there is a pending transition for access tier. + :vartype access_tier_status: str + :ivar share_usage_bytes: The approximate size of the data stored on the share. Note that this + value may not include all recently created or recently resized files. + :vartype share_usage_bytes: long + :ivar lease_status: The lease status of the share. Possible values include: "Locked", + "Unlocked". + :vartype lease_status: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseStatus + :ivar lease_state: Lease state of the share. Possible values include: "Available", "Leased", + "Expired", "Breaking", "Broken". + :vartype lease_state: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseState + :ivar lease_duration: Specifies whether the lease on a share is of infinite or fixed duration, + only when the share is leased. Possible values include: "Infinite", "Fixed". + :vartype lease_duration: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseDuration + :ivar signed_identifiers: List of stored access policies specified on the share. + :vartype signed_identifiers: list[~azure.mgmt.storage.v2021_08_01.models.SignedIdentifier] + :ivar snapshot_time: Creation time of share snapshot returned in the response of list shares + with expand param "snapshots". + :vartype snapshot_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'access_tier_change_time': {'readonly': True}, + 'access_tier_status': {'readonly': True}, + 'share_usage_bytes': {'readonly': True}, + 'lease_status': {'readonly': True}, + 'lease_state': {'readonly': True}, + 'lease_duration': {'readonly': True}, + 'snapshot_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, + 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, + 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, + 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'long'}, + 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, + 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, + 'signed_identifiers': {'key': 'properties.signedIdentifiers', 'type': '[SignedIdentifier]'}, + 'snapshot_time': {'key': 'properties.snapshotTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + share_quota: Optional[int] = None, + enabled_protocols: Optional[Union[str, "EnabledProtocols"]] = None, + root_squash: Optional[Union[str, "RootSquashType"]] = None, + access_tier: Optional[Union[str, "ShareAccessTier"]] = None, + signed_identifiers: Optional[List["SignedIdentifier"]] = None, + **kwargs + ): + """ + :keyword metadata: A name-value pair to associate with the share as metadata. + :paramtype metadata: dict[str, str] + :keyword share_quota: The maximum size of the share, in gigabytes. Must be greater than 0, and + less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + :paramtype share_quota: int + :keyword enabled_protocols: The authentication protocol that is used for the file share. Can + only be specified when creating a share. Possible values include: "SMB", "NFS". + :paramtype enabled_protocols: str or ~azure.mgmt.storage.v2021_08_01.models.EnabledProtocols + :keyword root_squash: The property is for NFS share only. The default is NoRootSquash. Possible + values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.mgmt.storage.v2021_08_01.models.RootSquashType + :keyword access_tier: Access tier for specific share. GpV2 account can choose between + TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible + values include: "TransactionOptimized", "Hot", "Cool", "Premium". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.ShareAccessTier + :keyword signed_identifiers: List of stored access policies specified on the share. + :paramtype signed_identifiers: list[~azure.mgmt.storage.v2021_08_01.models.SignedIdentifier] + """ + super(FileShareItem, self).__init__(**kwargs) + self.last_modified_time = None + self.metadata = metadata + self.share_quota = share_quota + self.enabled_protocols = enabled_protocols + self.root_squash = root_squash + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.access_tier = access_tier + self.access_tier_change_time = None + self.access_tier_status = None + self.share_usage_bytes = None + self.lease_status = None + self.lease_state = None + self.lease_duration = None + self.signed_identifiers = signed_identifiers + self.snapshot_time = None + + +class FileShareItems(msrest.serialization.Model): + """Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of file shares returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.FileShareItem] + :ivar next_link: Request URL that can be used to query next page of shares. Returned when total + number of requested shares exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FileShareItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FileShareItems, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class GeoReplicationStats(msrest.serialization.Model): + """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is enabled for the storage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the secondary location. Possible values are: - Live: Indicates that + the secondary location is active and operational. - Bootstrap: Indicates initial + synchronization from the primary location to the secondary location is in progress.This + typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary + location is temporarily unavailable. Possible values include: "Live", "Bootstrap", + "Unavailable". + :vartype status: str or ~azure.mgmt.storage.v2021_08_01.models.GeoReplicationStatus + :ivar last_sync_time: All primary writes preceding this UTC date/time value are guaranteed to + be available for read operations. Primary writes following this point in time may or may not be + available for reads. Element may be default value if value of LastSyncTime is not available, + this can happen if secondary is offline or we are in bootstrap. + :vartype last_sync_time: ~datetime.datetime + :ivar can_failover: A boolean flag which indicates whether or not account failover is supported + for the account. + :vartype can_failover: bool + """ + + _validation = { + 'status': {'readonly': True}, + 'last_sync_time': {'readonly': True}, + 'can_failover': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, + 'can_failover': {'key': 'canFailover', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GeoReplicationStats, self).__init__(**kwargs) + self.status = None + self.last_sync_time = None + self.can_failover = None + + +class Identity(msrest.serialization.Model): + """Identity for the 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 principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: Required. The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.storage.v2021_08_01.models.IdentityType + :ivar user_assigned_identities: Gets or sets a list of key value pairs that describe the set of + User Assigned identities that will be used with this storage account. The key is the ARM + resource identifier of the identity. Only 1 User Assigned identity is permitted here. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.storage.v2021_08_01.models.UserAssignedIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': 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': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "IdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.storage.v2021_08_01.models.IdentityType + :keyword user_assigned_identities: Gets or sets a list of key value pairs that describe the set + of User Assigned identities that will be used with this storage account. The key is the ARM + resource identifier of the identity. Only 1 User Assigned identity is permitted here. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.storage.v2021_08_01.models.UserAssignedIdentity] + """ + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ImmutabilityPolicy(AzureEntityResource): + """The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the + container since the policy creation, in days. + :vartype immutability_period_since_creation_in_days: int + :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked + and Unlocked. Possible values include: "Locked", "Unlocked". + :vartype state: str or ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicyState + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based + retention policies. When enabled, new blocks can be written to an append blob while maintaining + immutability protection and compliance. Only new blocks can be added and any existing blocks + cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy + API. + :vartype allow_protected_append_writes: bool + :ivar allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :vartype allow_protected_append_writes_all: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, + 'allow_protected_append_writes_all': {'key': 'properties.allowProtectedAppendWritesAll', 'type': 'bool'}, + } + + def __init__( + self, + *, + immutability_period_since_creation_in_days: Optional[int] = None, + allow_protected_append_writes: Optional[bool] = None, + allow_protected_append_writes_all: Optional[bool] = None, + **kwargs + ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + :keyword allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :paramtype allow_protected_append_writes_all: bool + """ + super(ImmutabilityPolicy, self).__init__(**kwargs) + self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days + self.state = None + self.allow_protected_append_writes = allow_protected_append_writes + self.allow_protected_append_writes_all = allow_protected_append_writes_all + + +class ImmutabilityPolicyProperties(msrest.serialization.Model): + """The properties of an ImmutabilityPolicy of a blob container. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar etag: ImmutabilityPolicy Etag. + :vartype etag: str + :ivar update_history: The ImmutabilityPolicy update history of the blob container. + :vartype update_history: list[~azure.mgmt.storage.v2021_08_01.models.UpdateHistoryProperty] + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the + container since the policy creation, in days. + :vartype immutability_period_since_creation_in_days: int + :ivar state: The ImmutabilityPolicy state of a blob container, possible values include: Locked + and Unlocked. Possible values include: "Locked", "Unlocked". + :vartype state: str or ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicyState + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based + retention policies. When enabled, new blocks can be written to an append blob while maintaining + immutability protection and compliance. Only new blocks can be added and any existing blocks + cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy + API. + :vartype allow_protected_append_writes: bool + :ivar allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :vartype allow_protected_append_writes_all: bool + """ + + _validation = { + 'etag': {'readonly': True}, + 'update_history': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'etag': {'key': 'etag', 'type': 'str'}, + 'update_history': {'key': 'updateHistory', 'type': '[UpdateHistoryProperty]'}, + 'immutability_period_since_creation_in_days': {'key': 'properties.immutabilityPeriodSinceCreationInDays', 'type': 'int'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'allow_protected_append_writes': {'key': 'properties.allowProtectedAppendWrites', 'type': 'bool'}, + 'allow_protected_append_writes_all': {'key': 'properties.allowProtectedAppendWritesAll', 'type': 'bool'}, + } + + def __init__( + self, + *, + immutability_period_since_creation_in_days: Optional[int] = None, + allow_protected_append_writes: Optional[bool] = None, + allow_protected_append_writes_all: Optional[bool] = None, + **kwargs + ): + """ + :keyword immutability_period_since_creation_in_days: The immutability period for the blobs in + the container since the policy creation, in days. + :paramtype immutability_period_since_creation_in_days: int + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + :keyword allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :paramtype allow_protected_append_writes_all: bool + """ + super(ImmutabilityPolicyProperties, self).__init__(**kwargs) + self.etag = None + self.update_history = None + self.immutability_period_since_creation_in_days = immutability_period_since_creation_in_days + self.state = None + self.allow_protected_append_writes = allow_protected_append_writes + self.allow_protected_append_writes_all = allow_protected_append_writes_all + + +class ImmutableStorageAccount(msrest.serialization.Model): + """This property enables and defines account-level immutability. Enabling the feature auto-enables Blob Versioning. + + :ivar enabled: A boolean flag which enables account-level immutability. All the containers + under such an account have object-level immutability enabled by default. + :vartype enabled: bool + :ivar immutability_policy: Specifies the default account-level immutability policy which is + inherited and applied to objects that do not possess an explicit immutability policy at the + object level. The object-level immutability policy has higher precedence than the + container-level immutability policy, which has a higher precedence than the account-level + immutability policy. + :vartype immutability_policy: + ~azure.mgmt.storage.v2021_08_01.models.AccountImmutabilityPolicyProperties + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'immutability_policy': {'key': 'immutabilityPolicy', 'type': 'AccountImmutabilityPolicyProperties'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + immutability_policy: Optional["AccountImmutabilityPolicyProperties"] = None, + **kwargs + ): + """ + :keyword enabled: A boolean flag which enables account-level immutability. All the containers + under such an account have object-level immutability enabled by default. + :paramtype enabled: bool + :keyword immutability_policy: Specifies the default account-level immutability policy which is + inherited and applied to objects that do not possess an explicit immutability policy at the + object level. The object-level immutability policy has higher precedence than the + container-level immutability policy, which has a higher precedence than the account-level + immutability policy. + :paramtype immutability_policy: + ~azure.mgmt.storage.v2021_08_01.models.AccountImmutabilityPolicyProperties + """ + super(ImmutableStorageAccount, self).__init__(**kwargs) + self.enabled = enabled + self.immutability_policy = immutability_policy + + +class ImmutableStorageWithVersioning(msrest.serialization.Model): + """Object level immutability properties of the container. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enabled: This is an immutable property, when set to true it enables object level + immutability at the container level. + :vartype enabled: bool + :ivar time_stamp: Returns the date and time the object level immutability was enabled. + :vartype time_stamp: ~datetime.datetime + :ivar migration_state: This property denotes the container level immutability to object level + immutability migration state. Possible values include: "InProgress", "Completed". + :vartype migration_state: str or ~azure.mgmt.storage.v2021_08_01.models.MigrationState + """ + + _validation = { + 'time_stamp': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, + 'migration_state': {'key': 'migrationState', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: This is an immutable property, when set to true it enables object level + immutability at the container level. + :paramtype enabled: bool + """ + super(ImmutableStorageWithVersioning, self).__init__(**kwargs) + self.enabled = enabled + self.time_stamp = None + self.migration_state = None + + +class IPRule(msrest.serialization.Model): + """IP rule with specific IP or IP range in CIDR format. + + All required parameters must be populated in order to send to Azure. + + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :vartype ip_address_or_range: str + :ivar action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :vartype action: str + """ + + _validation = { + 'ip_address_or_range': {'required': True}, + } + + _attribute_map = { + 'ip_address_or_range': {'key': 'value', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_address_or_range: str, + action: Optional[str] = None, + **kwargs + ): + """ + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + :keyword action: The action of IP ACL rule. The only acceptable values to pass in are None and + "Allow". The default value is None. + :paramtype action: str + """ + super(IPRule, self).__init__(**kwargs) + self.ip_address_or_range = ip_address_or_range + self.action = action + + +class KeyCreationTime(msrest.serialization.Model): + """Storage account keys creation time. + + :ivar key1: + :vartype key1: ~datetime.datetime + :ivar key2: + :vartype key2: ~datetime.datetime + """ + + _attribute_map = { + 'key1': {'key': 'key1', 'type': 'iso-8601'}, + 'key2': {'key': 'key2', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + key1: Optional[datetime.datetime] = None, + key2: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ + super(KeyCreationTime, self).__init__(**kwargs) + self.key1 = key1 + self.key2 = key2 + + +class KeyPolicy(msrest.serialization.Model): + """KeyPolicy assigned to the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar key_expiration_period_in_days: Required. The key expiration period in days. + :vartype key_expiration_period_in_days: int + """ + + _validation = { + 'key_expiration_period_in_days': {'required': True}, + } + + _attribute_map = { + 'key_expiration_period_in_days': {'key': 'keyExpirationPeriodInDays', 'type': 'int'}, + } + + def __init__( + self, + *, + key_expiration_period_in_days: int, + **kwargs + ): + """ + :keyword key_expiration_period_in_days: Required. The key expiration period in days. + :paramtype key_expiration_period_in_days: int + """ + super(KeyPolicy, self).__init__(**kwargs) + self.key_expiration_period_in_days = key_expiration_period_in_days + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties of key vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str + :ivar current_versioned_key_identifier: The object identifier of the current versioned Key + Vault Key in use. + :vartype current_versioned_key_identifier: str + :ivar last_key_rotation_timestamp: Timestamp of last rotation of the Key Vault Key. + :vartype last_key_rotation_timestamp: ~datetime.datetime + """ + + _validation = { + 'current_versioned_key_identifier': {'readonly': True}, + 'last_key_rotation_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyname', 'type': 'str'}, + 'key_version': {'key': 'keyversion', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, + 'current_versioned_key_identifier': {'key': 'currentVersionedKeyIdentifier', 'type': 'str'}, + 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + key_name: Optional[str] = None, + key_version: Optional[str] = None, + key_vault_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = key_name + self.key_version = key_version + self.key_vault_uri = key_vault_uri + self.current_versioned_key_identifier = None + self.last_key_rotation_timestamp = None + + +class LastAccessTimeTrackingPolicy(msrest.serialization.Model): + """The blob service properties for Last access time based tracking policy. + + All required parameters must be populated in order to send to Azure. + + :ivar enable: Required. When set to true last access time based tracking is enabled. + :vartype enable: bool + :ivar name: Name of the policy. The valid value is AccessTimeTracking. This field is currently + read only. Possible values include: "AccessTimeTracking". + :vartype name: str or ~azure.mgmt.storage.v2021_08_01.models.Name + :ivar tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :vartype tracking_granularity_in_days: int + :ivar blob_type: An array of predefined supported blob types. Only blockBlob is the supported + value. This field is currently read only. + :vartype blob_type: list[str] + """ + + _validation = { + 'enable': {'required': True}, + } + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tracking_granularity_in_days': {'key': 'trackingGranularityInDays', 'type': 'int'}, + 'blob_type': {'key': 'blobType', 'type': '[str]'}, + } + + def __init__( + self, + *, + enable: bool, + name: Optional[Union[str, "Name"]] = None, + tracking_granularity_in_days: Optional[int] = None, + blob_type: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword enable: Required. When set to true last access time based tracking is enabled. + :paramtype enable: bool + :keyword name: Name of the policy. The valid value is AccessTimeTracking. This field is + currently read only. Possible values include: "AccessTimeTracking". + :paramtype name: str or ~azure.mgmt.storage.v2021_08_01.models.Name + :keyword tracking_granularity_in_days: The field specifies blob object tracking granularity in + days, typically how often the blob object should be tracked.This field is currently read only + with value as 1. + :paramtype tracking_granularity_in_days: int + :keyword blob_type: An array of predefined supported blob types. Only blockBlob is the + supported value. This field is currently read only. + :paramtype blob_type: list[str] + """ + super(LastAccessTimeTrackingPolicy, self).__init__(**kwargs) + self.enable = enable + self.name = name + self.tracking_granularity_in_days = tracking_granularity_in_days + self.blob_type = blob_type + + +class LeaseContainerRequest(msrest.serialization.Model): + """Lease Container request schema. + + All required parameters must be populated in order to send to Azure. + + :ivar action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :vartype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerRequestAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue + before it is broken, in seconds, between 0 and 60. + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :vartype proposed_lease_id: str + """ + + _validation = { + 'action': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'lease_id': {'key': 'leaseId', 'type': 'str'}, + 'break_period': {'key': 'breakPeriod', 'type': 'int'}, + 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, + 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, + } + + def __init__( + self, + *, + action: Union[str, "LeaseContainerRequestAction"], + lease_id: Optional[str] = None, + break_period: Optional[int] = None, + lease_duration: Optional[int] = None, + proposed_lease_id: Optional[str] = None, + **kwargs + ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerRequestAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ + super(LeaseContainerRequest, self).__init__(**kwargs) + self.action = action + self.lease_id = lease_id + self.break_period = break_period + self.lease_duration = lease_duration + self.proposed_lease_id = proposed_lease_id + + +class LeaseContainerResponse(msrest.serialization.Model): + """Lease Container response schema. + + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the + container, or to renew, change, or release the lease. + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str + """ + + _attribute_map = { + 'lease_id': {'key': 'leaseId', 'type': 'str'}, + 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, + } + + def __init__( + self, + *, + lease_id: Optional[str] = None, + lease_time_seconds: Optional[str] = None, + **kwargs + ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the container, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ + super(LeaseContainerResponse, self).__init__(**kwargs) + self.lease_id = lease_id + self.lease_time_seconds = lease_time_seconds + + +class LeaseShareRequest(msrest.serialization.Model): + """Lease Share request schema. + + All required parameters must be populated in order to send to Azure. + + :ivar action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :vartype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseShareAction + :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :vartype lease_id: str + :ivar break_period: Optional. For a break action, proposed duration the lease should continue + before it is broken, in seconds, between 0 and 60. + :vartype break_period: int + :ivar lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, or + negative one (-1) for a lease that never expires. + :vartype lease_duration: int + :ivar proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :vartype proposed_lease_id: str + """ + + _validation = { + 'action': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'lease_id': {'key': 'leaseId', 'type': 'str'}, + 'break_period': {'key': 'breakPeriod', 'type': 'int'}, + 'lease_duration': {'key': 'leaseDuration', 'type': 'int'}, + 'proposed_lease_id': {'key': 'proposedLeaseId', 'type': 'str'}, + } + + def __init__( + self, + *, + action: Union[str, "LeaseShareAction"], + lease_id: Optional[str] = None, + break_period: Optional[int] = None, + lease_duration: Optional[int] = None, + proposed_lease_id: Optional[str] = None, + **kwargs + ): + """ + :keyword action: Required. Specifies the lease action. Can be one of the available actions. + Possible values include: "Acquire", "Renew", "Change", "Release", "Break". + :paramtype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseShareAction + :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. + :paramtype lease_id: str + :keyword break_period: Optional. For a break action, proposed duration the lease should + continue before it is broken, in seconds, between 0 and 60. + :paramtype break_period: int + :keyword lease_duration: Required for acquire. Specifies the duration of the lease, in seconds, + or negative one (-1) for a lease that never expires. + :paramtype lease_duration: int + :keyword proposed_lease_id: Optional for acquire, required for change. Proposed lease ID, in a + GUID string format. + :paramtype proposed_lease_id: str + """ + super(LeaseShareRequest, self).__init__(**kwargs) + self.action = action + self.lease_id = lease_id + self.break_period = break_period + self.lease_duration = lease_duration + self.proposed_lease_id = proposed_lease_id + + +class LeaseShareResponse(msrest.serialization.Model): + """Lease Share response schema. + + :ivar lease_id: Returned unique lease ID that must be included with any request to delete the + share, or to renew, change, or release the lease. + :vartype lease_id: str + :ivar lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :vartype lease_time_seconds: str + """ + + _attribute_map = { + 'lease_id': {'key': 'leaseId', 'type': 'str'}, + 'lease_time_seconds': {'key': 'leaseTimeSeconds', 'type': 'str'}, + } + + def __init__( + self, + *, + lease_id: Optional[str] = None, + lease_time_seconds: Optional[str] = None, + **kwargs + ): + """ + :keyword lease_id: Returned unique lease ID that must be included with any request to delete + the share, or to renew, change, or release the lease. + :paramtype lease_id: str + :keyword lease_time_seconds: Approximate time remaining in the lease period, in seconds. + :paramtype lease_time_seconds: str + """ + super(LeaseShareResponse, self).__init__(**kwargs) + self.lease_id = lease_id + self.lease_time_seconds = lease_time_seconds + + +class LegalHold(msrest.serialization.Model): + """The LegalHold property of a blob container. + + 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 has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at + least one existing tag. The hasLegalHold public property is set to false by SRP if all existing + legal hold tags are cleared out. There can be a maximum of 1000 blob containers with + hasLegalHold=true for a given account. + :vartype has_legal_hold: bool + :ivar tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and is + normalized to lower case at SRP. + :vartype tags: list[str] + :ivar allow_protected_append_writes_all: When enabled, new blocks can be written to both + 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks + can be added and any existing blocks cannot be modified or deleted. + :vartype allow_protected_append_writes_all: bool + """ + + _validation = { + 'has_legal_hold': {'readonly': True}, + 'tags': {'required': True}, + } + + _attribute_map = { + 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'allow_protected_append_writes_all': {'key': 'allowProtectedAppendWritesAll', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: List[str], + allow_protected_append_writes_all: Optional[bool] = None, + **kwargs + ): + """ + :keyword tags: Required. A set of tags. Each tag should be 3 to 23 alphanumeric characters and + is normalized to lower case at SRP. + :paramtype tags: list[str] + :keyword allow_protected_append_writes_all: When enabled, new blocks can be written to both + 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks + can be added and any existing blocks cannot be modified or deleted. + :paramtype allow_protected_append_writes_all: bool + """ + super(LegalHold, self).__init__(**kwargs) + self.has_legal_hold = None + self.tags = tags + self.allow_protected_append_writes_all = allow_protected_append_writes_all + + +class LegalHoldProperties(msrest.serialization.Model): + """The LegalHold property of a blob container. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at + least one existing tag. The hasLegalHold public property is set to false by SRP if all existing + legal hold tags are cleared out. There can be a maximum of 1000 blob containers with + hasLegalHold=true for a given account. + :vartype has_legal_hold: bool + :ivar tags: A set of tags. The list of LegalHold tags of a blob container. + :vartype tags: list[~azure.mgmt.storage.v2021_08_01.models.TagProperty] + :ivar protected_append_writes_history: Protected append blob writes history. + :vartype protected_append_writes_history: + ~azure.mgmt.storage.v2021_08_01.models.ProtectedAppendWritesHistory + """ + + _validation = { + 'has_legal_hold': {'readonly': True}, + } + + _attribute_map = { + 'has_legal_hold': {'key': 'hasLegalHold', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '[TagProperty]'}, + 'protected_append_writes_history': {'key': 'protectedAppendWritesHistory', 'type': 'ProtectedAppendWritesHistory'}, + } + + def __init__( + self, + *, + tags: Optional[List["TagProperty"]] = None, + protected_append_writes_history: Optional["ProtectedAppendWritesHistory"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The list of LegalHold tags of a blob container. + :paramtype tags: list[~azure.mgmt.storage.v2021_08_01.models.TagProperty] + :keyword protected_append_writes_history: Protected append blob writes history. + :paramtype protected_append_writes_history: + ~azure.mgmt.storage.v2021_08_01.models.ProtectedAppendWritesHistory + """ + super(LegalHoldProperties, self).__init__(**kwargs) + self.has_legal_hold = None + self.tags = tags + self.protected_append_writes_history = protected_append_writes_history + + +class ListAccountSasResponse(msrest.serialization.Model): + """The List SAS credentials operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_sas_token: List SAS credentials of storage account. + :vartype account_sas_token: str + """ + + _validation = { + 'account_sas_token': {'readonly': True}, + } + + _attribute_map = { + 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListAccountSasResponse, self).__init__(**kwargs) + self.account_sas_token = None + + +class ListBlobInventoryPolicy(msrest.serialization.Model): + """List of blob inventory policies returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of blob inventory policies. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BlobInventoryPolicy]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListBlobInventoryPolicy, self).__init__(**kwargs) + self.value = None + + +class ListContainerItem(AzureEntityResource): + """The blob container properties be listed out. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar version: The version of the deleted blob container. + :vartype version: str + :ivar deleted: Indicates whether the blob container was deleted. + :vartype deleted: bool + :ivar deleted_time: Blob container deletion time. + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: Remaining retention days for soft deleted blob container. + :vartype remaining_retention_days: int + :ivar default_encryption_scope: Default the container to use specified encryption scope for all + writes. + :vartype default_encryption_scope: str + :ivar deny_encryption_scope_override: Block override of encryption scope from the container + default. + :vartype deny_encryption_scope_override: bool + :ivar public_access: Specifies whether data in the container may be accessed publicly and the + level of access. Possible values include: "Container", "Blob", "None". + :vartype public_access: str or ~azure.mgmt.storage.v2021_08_01.models.PublicAccess + :ivar last_modified_time: Returns the date and time the container was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar lease_status: The lease status of the container. Possible values include: "Locked", + "Unlocked". + :vartype lease_status: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseStatus + :ivar lease_state: Lease state of the container. Possible values include: "Available", + "Leased", "Expired", "Breaking", "Broken". + :vartype lease_state: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseState + :ivar lease_duration: Specifies whether the lease on a container is of infinite or fixed + duration, only when the container is leased. Possible values include: "Infinite", "Fixed". + :vartype lease_duration: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseDuration + :ivar metadata: A name-value pair to associate with the container as metadata. + :vartype metadata: dict[str, str] + :ivar immutability_policy: The ImmutabilityPolicy property of the container. + :vartype immutability_policy: + ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicyProperties + :ivar legal_hold: The LegalHold property of the container. + :vartype legal_hold: ~azure.mgmt.storage.v2021_08_01.models.LegalHoldProperties + :ivar has_legal_hold: The hasLegalHold public property is set to true by SRP if there are at + least one existing tag. The hasLegalHold public property is set to false by SRP if all existing + legal hold tags are cleared out. There can be a maximum of 1000 blob containers with + hasLegalHold=true for a given account. + :vartype has_legal_hold: bool + :ivar has_immutability_policy: The hasImmutabilityPolicy public property is set to true by SRP + if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public + property is set to false by SRP if ImmutabilityPolicy has not been created for this container. + :vartype has_immutability_policy: bool + :ivar immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :vartype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageWithVersioning + :ivar enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :vartype enable_nfs_v3_root_squash: bool + :ivar enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :vartype enable_nfs_v3_all_squash: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'lease_status': {'readonly': True}, + 'lease_state': {'readonly': True}, + 'lease_duration': {'readonly': True}, + 'immutability_policy': {'readonly': True}, + 'legal_hold': {'readonly': True}, + 'has_legal_hold': {'readonly': True}, + 'has_immutability_policy': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'default_encryption_scope': {'key': 'properties.defaultEncryptionScope', 'type': 'str'}, + 'deny_encryption_scope_override': {'key': 'properties.denyEncryptionScopeOverride', 'type': 'bool'}, + 'public_access': {'key': 'properties.publicAccess', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'lease_status': {'key': 'properties.leaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'properties.leaseState', 'type': 'str'}, + 'lease_duration': {'key': 'properties.leaseDuration', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'immutability_policy': {'key': 'properties.immutabilityPolicy', 'type': 'ImmutabilityPolicyProperties'}, + 'legal_hold': {'key': 'properties.legalHold', 'type': 'LegalHoldProperties'}, + 'has_legal_hold': {'key': 'properties.hasLegalHold', 'type': 'bool'}, + 'has_immutability_policy': {'key': 'properties.hasImmutabilityPolicy', 'type': 'bool'}, + 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageWithVersioning'}, + 'enable_nfs_v3_root_squash': {'key': 'properties.enableNfsV3RootSquash', 'type': 'bool'}, + 'enable_nfs_v3_all_squash': {'key': 'properties.enableNfsV3AllSquash', 'type': 'bool'}, + } + + def __init__( + self, + *, + default_encryption_scope: Optional[str] = None, + deny_encryption_scope_override: Optional[bool] = None, + public_access: Optional[Union[str, "PublicAccess"]] = None, + metadata: Optional[Dict[str, str]] = None, + immutable_storage_with_versioning: Optional["ImmutableStorageWithVersioning"] = None, + enable_nfs_v3_root_squash: Optional[bool] = None, + enable_nfs_v3_all_squash: Optional[bool] = None, + **kwargs + ): + """ + :keyword default_encryption_scope: Default the container to use specified encryption scope for + all writes. + :paramtype default_encryption_scope: str + :keyword deny_encryption_scope_override: Block override of encryption scope from the container + default. + :paramtype deny_encryption_scope_override: bool + :keyword public_access: Specifies whether data in the container may be accessed publicly and + the level of access. Possible values include: "Container", "Blob", "None". + :paramtype public_access: str or ~azure.mgmt.storage.v2021_08_01.models.PublicAccess + :keyword metadata: A name-value pair to associate with the container as metadata. + :paramtype metadata: dict[str, str] + :keyword immutable_storage_with_versioning: The object level immutability property of the + container. The property is immutable and can only be set to true at the container creation + time. Existing containers must undergo a migration process. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageWithVersioning + :keyword enable_nfs_v3_root_squash: Enable NFSv3 root squash on blob container. + :paramtype enable_nfs_v3_root_squash: bool + :keyword enable_nfs_v3_all_squash: Enable NFSv3 all squash on blob container. + :paramtype enable_nfs_v3_all_squash: bool + """ + super(ListContainerItem, self).__init__(**kwargs) + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.default_encryption_scope = default_encryption_scope + self.deny_encryption_scope_override = deny_encryption_scope_override + self.public_access = public_access + self.last_modified_time = None + self.lease_status = None + self.lease_state = None + self.lease_duration = None + self.metadata = metadata + self.immutability_policy = None + self.legal_hold = None + self.has_legal_hold = None + self.has_immutability_policy = None + self.immutable_storage_with_versioning = immutable_storage_with_versioning + self.enable_nfs_v3_root_squash = enable_nfs_v3_root_squash + self.enable_nfs_v3_all_squash = enable_nfs_v3_all_squash + + +class ListContainerItems(msrest.serialization.Model): + """Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of blobs containers returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.ListContainerItem] + :ivar next_link: Request URL that can be used to query next page of containers. Returned when + total number of requested containers exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ListContainerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListContainerItems, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ListQueue(Resource): + """ListQueue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ + super(ListQueue, self).__init__(**kwargs) + self.metadata = metadata + + +class ListQueueResource(msrest.serialization.Model): + """Response schema. Contains list of queues returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of queues returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.ListQueue] + :ivar next_link: Request URL that can be used to list next page of queues. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ListQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListQueueResource, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ListQueueServices(msrest.serialization.Model): + """ListQueueServices. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of queue services returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueueServiceProperties]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListQueueServices, self).__init__(**kwargs) + self.value = None + + +class ListServiceSasResponse(msrest.serialization.Model): + """The List service SAS credentials operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_sas_token: List service SAS credentials of specific resource. + :vartype service_sas_token: str + """ + + _validation = { + 'service_sas_token': {'readonly': True}, + } + + _attribute_map = { + 'service_sas_token': {'key': 'serviceSasToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListServiceSasResponse, self).__init__(**kwargs) + self.service_sas_token = None + + +class ListTableResource(msrest.serialization.Model): + """Response schema. Contains list of tables returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of tables returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.Table] + :ivar next_link: Request URL that can be used to query next page of tables. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Table]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListTableResource, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ListTableServices(msrest.serialization.Model): + """ListTableServices. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of table services returned. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TableServiceProperties]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ListTableServices, self).__init__(**kwargs) + self.value = None + + +class LocalUser(Resource): + """The local user associated with the storage accounts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.storage.v2021_08_01.models.SystemData + :ivar permission_scopes: The permission scopes of the local user. + :vartype permission_scopes: list[~azure.mgmt.storage.v2021_08_01.models.PermissionScope] + :ivar home_directory: Optional, local user home directory. + :vartype home_directory: str + :ivar ssh_authorized_keys: Optional, local user ssh authorized keys for SFTP. + :vartype ssh_authorized_keys: list[~azure.mgmt.storage.v2021_08_01.models.SshPublicKey] + :ivar sid: A unique Security Identifier that is generated by the server. + :vartype sid: str + :ivar has_shared_key: Indicates whether shared key exists. Set it to false to remove existing + shared key. + :vartype has_shared_key: bool + :ivar has_ssh_key: Indicates whether ssh key exists. Set it to false to remove existing SSH + key. + :vartype has_ssh_key: bool + :ivar has_ssh_password: Indicates whether ssh password exists. Set it to false to remove + existing SSH password. + :vartype has_ssh_password: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'sid': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'permission_scopes': {'key': 'properties.permissionScopes', 'type': '[PermissionScope]'}, + 'home_directory': {'key': 'properties.homeDirectory', 'type': 'str'}, + 'ssh_authorized_keys': {'key': 'properties.sshAuthorizedKeys', 'type': '[SshPublicKey]'}, + 'sid': {'key': 'properties.sid', 'type': 'str'}, + 'has_shared_key': {'key': 'properties.hasSharedKey', 'type': 'bool'}, + 'has_ssh_key': {'key': 'properties.hasSshKey', 'type': 'bool'}, + 'has_ssh_password': {'key': 'properties.hasSshPassword', 'type': 'bool'}, + } + + def __init__( + self, + *, + permission_scopes: Optional[List["PermissionScope"]] = None, + home_directory: Optional[str] = None, + ssh_authorized_keys: Optional[List["SshPublicKey"]] = None, + has_shared_key: Optional[bool] = None, + has_ssh_key: Optional[bool] = None, + has_ssh_password: Optional[bool] = None, + **kwargs + ): + """ + :keyword permission_scopes: The permission scopes of the local user. + :paramtype permission_scopes: list[~azure.mgmt.storage.v2021_08_01.models.PermissionScope] + :keyword home_directory: Optional, local user home directory. + :paramtype home_directory: str + :keyword ssh_authorized_keys: Optional, local user ssh authorized keys for SFTP. + :paramtype ssh_authorized_keys: list[~azure.mgmt.storage.v2021_08_01.models.SshPublicKey] + :keyword has_shared_key: Indicates whether shared key exists. Set it to false to remove + existing shared key. + :paramtype has_shared_key: bool + :keyword has_ssh_key: Indicates whether ssh key exists. Set it to false to remove existing SSH + key. + :paramtype has_ssh_key: bool + :keyword has_ssh_password: Indicates whether ssh password exists. Set it to false to remove + existing SSH password. + :paramtype has_ssh_password: bool + """ + super(LocalUser, self).__init__(**kwargs) + self.system_data = None + self.permission_scopes = permission_scopes + self.home_directory = home_directory + self.ssh_authorized_keys = ssh_authorized_keys + self.sid = None + self.has_shared_key = has_shared_key + self.has_ssh_key = has_ssh_key + self.has_ssh_password = has_ssh_password + + +class LocalUserKeys(msrest.serialization.Model): + """The Storage Account Local User keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ssh_authorized_keys: Optional, local user ssh authorized keys for SFTP. + :vartype ssh_authorized_keys: list[~azure.mgmt.storage.v2021_08_01.models.SshPublicKey] + :ivar shared_key: Auto generated by the server for SMB authentication. + :vartype shared_key: str + """ + + _validation = { + 'shared_key': {'readonly': True}, + } + + _attribute_map = { + 'ssh_authorized_keys': {'key': 'sshAuthorizedKeys', 'type': '[SshPublicKey]'}, + 'shared_key': {'key': 'sharedKey', 'type': 'str'}, + } + + def __init__( + self, + *, + ssh_authorized_keys: Optional[List["SshPublicKey"]] = None, + **kwargs + ): + """ + :keyword ssh_authorized_keys: Optional, local user ssh authorized keys for SFTP. + :paramtype ssh_authorized_keys: list[~azure.mgmt.storage.v2021_08_01.models.SshPublicKey] + """ + super(LocalUserKeys, self).__init__(**kwargs) + self.ssh_authorized_keys = ssh_authorized_keys + self.shared_key = None + + +class LocalUserRegeneratePasswordResult(msrest.serialization.Model): + """The secrets of Storage Account Local User. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ssh_password: Auto generated password by the server for SSH authentication if + hasSshPassword is set to true on the creation of local user. + :vartype ssh_password: str + """ + + _validation = { + 'ssh_password': {'readonly': True}, + } + + _attribute_map = { + 'ssh_password': {'key': 'sshPassword', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(LocalUserRegeneratePasswordResult, self).__init__(**kwargs) + self.ssh_password = None + + +class LocalUsers(msrest.serialization.Model): + """List storage account local users. + + :ivar value: The local users associated with the storage account. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.LocalUser] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LocalUser]'}, + } + + def __init__( + self, + *, + value: Optional[List["LocalUser"]] = None, + **kwargs + ): + """ + :keyword value: The local users associated with the storage account. + :paramtype value: list[~azure.mgmt.storage.v2021_08_01.models.LocalUser] + """ + super(LocalUsers, self).__init__(**kwargs) + self.value = value + + +class ManagementPolicy(Resource): + """The Get Storage Account ManagementPolicies operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar last_modified_time: Returns the date and time the ManagementPolicies was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :vartype policy: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicySchema + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'policy': {'key': 'properties.policy', 'type': 'ManagementPolicySchema'}, + } + + def __init__( + self, + *, + policy: Optional["ManagementPolicySchema"] = None, + **kwargs + ): + """ + :keyword policy: The Storage Account ManagementPolicy, in JSON format. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype policy: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicySchema + """ + super(ManagementPolicy, self).__init__(**kwargs) + self.last_modified_time = None + self.policy = policy + + +class ManagementPolicyAction(msrest.serialization.Model): + """Actions are applied to the filtered blobs when the execution condition is met. + + :ivar base_blob: The management policy action for base blob. + :vartype base_blob: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyBaseBlob + :ivar snapshot: The management policy action for snapshot. + :vartype snapshot: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicySnapShot + :ivar version: The management policy action for version. + :vartype version: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyVersion + """ + + _attribute_map = { + 'base_blob': {'key': 'baseBlob', 'type': 'ManagementPolicyBaseBlob'}, + 'snapshot': {'key': 'snapshot', 'type': 'ManagementPolicySnapShot'}, + 'version': {'key': 'version', 'type': 'ManagementPolicyVersion'}, + } + + def __init__( + self, + *, + base_blob: Optional["ManagementPolicyBaseBlob"] = None, + snapshot: Optional["ManagementPolicySnapShot"] = None, + version: Optional["ManagementPolicyVersion"] = None, + **kwargs + ): + """ + :keyword base_blob: The management policy action for base blob. + :paramtype base_blob: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyBaseBlob + :keyword snapshot: The management policy action for snapshot. + :paramtype snapshot: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicySnapShot + :keyword version: The management policy action for version. + :paramtype version: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyVersion + """ + super(ManagementPolicyAction, self).__init__(**kwargs) + self.base_blob = base_blob + self.snapshot = snapshot + self.version = version + + +class ManagementPolicyBaseBlob(msrest.serialization.Model): + """Management policy action for base blob. + + :ivar tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at Hot + tier. + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_08_01.models.DateAfterModification + :ivar tier_to_archive: The function to tier blobs to archive storage. Support blobs currently + at Hot or Cool tier. + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_08_01.models.DateAfterModification + :ivar delete: The function to delete the blob. + :vartype delete: ~azure.mgmt.storage.v2021_08_01.models.DateAfterModification + :ivar enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from cool + to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + :vartype enable_auto_tier_to_hot_from_cool: bool + """ + + _attribute_map = { + 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterModification'}, + 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterModification'}, + 'delete': {'key': 'delete', 'type': 'DateAfterModification'}, + 'enable_auto_tier_to_hot_from_cool': {'key': 'enableAutoTierToHotFromCool', 'type': 'bool'}, + } + + def __init__( + self, + *, + tier_to_cool: Optional["DateAfterModification"] = None, + tier_to_archive: Optional["DateAfterModification"] = None, + delete: Optional["DateAfterModification"] = None, + enable_auto_tier_to_hot_from_cool: Optional[bool] = None, + **kwargs + ): + """ + :keyword tier_to_cool: The function to tier blobs to cool storage. Support blobs currently at + Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_08_01.models.DateAfterModification + :keyword tier_to_archive: The function to tier blobs to archive storage. Support blobs + currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_08_01.models.DateAfterModification + :keyword delete: The function to delete the blob. + :paramtype delete: ~azure.mgmt.storage.v2021_08_01.models.DateAfterModification + :keyword enable_auto_tier_to_hot_from_cool: This property enables auto tiering of a blob from + cool to hot on a blob access. This property requires + tierToCool.daysAfterLastAccessTimeGreaterThan. + :paramtype enable_auto_tier_to_hot_from_cool: bool + """ + super(ManagementPolicyBaseBlob, self).__init__(**kwargs) + self.tier_to_cool = tier_to_cool + self.tier_to_archive = tier_to_archive + self.delete = delete + self.enable_auto_tier_to_hot_from_cool = enable_auto_tier_to_hot_from_cool + + +class ManagementPolicyDefinition(msrest.serialization.Model): + """An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set. + + All required parameters must be populated in order to send to Azure. + + :ivar actions: Required. An object that defines the action set. + :vartype actions: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyAction + :ivar filters: An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyFilter + """ + + _validation = { + 'actions': {'required': True}, + } + + _attribute_map = { + 'actions': {'key': 'actions', 'type': 'ManagementPolicyAction'}, + 'filters': {'key': 'filters', 'type': 'ManagementPolicyFilter'}, + } + + def __init__( + self, + *, + actions: "ManagementPolicyAction", + filters: Optional["ManagementPolicyFilter"] = None, + **kwargs + ): + """ + :keyword actions: Required. An object that defines the action set. + :paramtype actions: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyAction + :keyword filters: An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyFilter + """ + super(ManagementPolicyDefinition, self).__init__(**kwargs) + self.actions = actions + self.filters = filters + + +class ManagementPolicyFilter(msrest.serialization.Model): + """Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical AND is performed on all filters. + + All required parameters must be populated in order to send to Azure. + + :ivar prefix_match: An array of strings for prefixes to be match. + :vartype prefix_match: list[str] + :ivar blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :vartype blob_types: list[str] + :ivar blob_index_match: An array of blob index tag based filters, there can be at most 10 tag + filters. + :vartype blob_index_match: list[~azure.mgmt.storage.v2021_08_01.models.TagFilter] + """ + + _validation = { + 'blob_types': {'required': True}, + } + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, + 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, + } + + def __init__( + self, + *, + blob_types: List[str], + prefix_match: Optional[List[str]] = None, + blob_index_match: Optional[List["TagFilter"]] = None, + **kwargs + ): + """ + :keyword prefix_match: An array of strings for prefixes to be match. + :paramtype prefix_match: list[str] + :keyword blob_types: Required. An array of predefined enum values. Currently blockBlob supports + all tiering and delete actions. Only delete actions are supported for appendBlob. + :paramtype blob_types: list[str] + :keyword blob_index_match: An array of blob index tag based filters, there can be at most 10 + tag filters. + :paramtype blob_index_match: list[~azure.mgmt.storage.v2021_08_01.models.TagFilter] + """ + super(ManagementPolicyFilter, self).__init__(**kwargs) + self.prefix_match = prefix_match + self.blob_types = blob_types + self.blob_index_match = blob_index_match + + +class ManagementPolicyRule(msrest.serialization.Model): + """An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Rule is enabled if set to true. + :vartype enabled: bool + :ivar name: Required. A rule name can contain any combination of alpha numeric characters. Rule + name is case-sensitive. It must be unique within a policy. + :vartype name: str + :ivar type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :vartype type: str or ~azure.mgmt.storage.v2021_08_01.models.RuleType + :ivar definition: Required. An object that defines the Lifecycle rule. + :vartype definition: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyDefinition + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + 'definition': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'definition': {'key': 'definition', 'type': 'ManagementPolicyDefinition'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "RuleType"], + definition: "ManagementPolicyDefinition", + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Rule is enabled if set to true. + :paramtype enabled: bool + :keyword name: Required. A rule name can contain any combination of alpha numeric characters. + Rule name is case-sensitive. It must be unique within a policy. + :paramtype name: str + :keyword type: Required. The valid value is Lifecycle. Possible values include: "Lifecycle". + :paramtype type: str or ~azure.mgmt.storage.v2021_08_01.models.RuleType + :keyword definition: Required. An object that defines the Lifecycle rule. + :paramtype definition: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyDefinition + """ + super(ManagementPolicyRule, self).__init__(**kwargs) + self.enabled = enabled + self.name = name + self.type = type + self.definition = definition + + +class ManagementPolicySchema(msrest.serialization.Model): + """The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + + All required parameters must be populated in order to send to Azure. + + :ivar rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :vartype rules: list[~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyRule] + """ + + _validation = { + 'rules': {'required': True}, + } + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[ManagementPolicyRule]'}, + } + + def __init__( + self, + *, + rules: List["ManagementPolicyRule"], + **kwargs + ): + """ + :keyword rules: Required. The Storage Account ManagementPolicies Rules. See more details in: + https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + :paramtype rules: list[~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyRule] + """ + super(ManagementPolicySchema, self).__init__(**kwargs) + self.rules = rules + + +class ManagementPolicySnapShot(msrest.serialization.Model): + """Management policy action for snapshot. + + :ivar tier_to_cool: The function to tier blob snapshot to cool storage. Support blob snapshot + currently at Hot tier. + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :ivar delete: The function to delete the blob snapshot. + :vartype delete: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + """ + + _attribute_map = { + 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, + 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, + 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, + } + + def __init__( + self, + *, + tier_to_cool: Optional["DateAfterCreation"] = None, + tier_to_archive: Optional["DateAfterCreation"] = None, + delete: Optional["DateAfterCreation"] = None, + **kwargs + ): + """ + :keyword tier_to_cool: The function to tier blob snapshot to cool storage. Support blob + snapshot currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob snapshot to archive storage. Support blob + snapshot currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :keyword delete: The function to delete the blob snapshot. + :paramtype delete: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + """ + super(ManagementPolicySnapShot, self).__init__(**kwargs) + self.tier_to_cool = tier_to_cool + self.tier_to_archive = tier_to_archive + self.delete = delete + + +class ManagementPolicyVersion(msrest.serialization.Model): + """Management policy action for blob version. + + :ivar tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :vartype tier_to_cool: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :ivar tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :vartype tier_to_archive: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :ivar delete: The function to delete the blob version. + :vartype delete: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + """ + + _attribute_map = { + 'tier_to_cool': {'key': 'tierToCool', 'type': 'DateAfterCreation'}, + 'tier_to_archive': {'key': 'tierToArchive', 'type': 'DateAfterCreation'}, + 'delete': {'key': 'delete', 'type': 'DateAfterCreation'}, + } + + def __init__( + self, + *, + tier_to_cool: Optional["DateAfterCreation"] = None, + tier_to_archive: Optional["DateAfterCreation"] = None, + delete: Optional["DateAfterCreation"] = None, + **kwargs + ): + """ + :keyword tier_to_cool: The function to tier blob version to cool storage. Support blob version + currently at Hot tier. + :paramtype tier_to_cool: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :keyword tier_to_archive: The function to tier blob version to archive storage. Support blob + version currently at Hot or Cool tier. + :paramtype tier_to_archive: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + :keyword delete: The function to delete the blob version. + :paramtype delete: ~azure.mgmt.storage.v2021_08_01.models.DateAfterCreation + """ + super(ManagementPolicyVersion, self).__init__(**kwargs) + self.tier_to_cool = tier_to_cool + self.tier_to_archive = tier_to_archive + self.delete = delete + + +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.storage.v2021_08_01.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'category': {'key': 'category', 'type': 'str'}, + 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + dimensions: Optional[List["Dimension"]] = None, + aggregation_type: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + category: Optional[str] = None, + resource_id_dimension_name_override: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.storage.v2021_08_01.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.dimensions = dimensions + self.aggregation_type = aggregation_type + self.fill_gap_with_zero = fill_gap_with_zero + self.category = category + self.resource_id_dimension_name_override = resource_id_dimension_name_override + + +class Multichannel(msrest.serialization.Model): + """Multichannel setting. Applies to Premium FileStorage only. + + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ + super(Multichannel, self).__init__(**kwargs) + self.enabled = enabled + + +class NetworkRuleSet(msrest.serialization.Model): + """Network rule set. + + All required parameters must be populated in order to send to Azure. + + :ivar bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible + values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), + or None to bypass none of those traffics. Possible values include: "None", "Logging", + "Metrics", "AzureServices". Default value: "AzureServices". + :vartype bypass: str or ~azure.mgmt.storage.v2021_08_01.models.Bypass + :ivar resource_access_rules: Sets the resource access rules. + :vartype resource_access_rules: list[~azure.mgmt.storage.v2021_08_01.models.ResourceAccessRule] + :ivar virtual_network_rules: Sets the virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.storage.v2021_08_01.models.VirtualNetworkRule] + :ivar ip_rules: Sets the IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.storage.v2021_08_01.models.IPRule] + :ivar default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :vartype default_action: str or ~azure.mgmt.storage.v2021_08_01.models.DefaultAction + """ + + _validation = { + 'default_action': {'required': True}, + } + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'resource_access_rules': {'key': 'resourceAccessRules', 'type': '[ResourceAccessRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + } + + def __init__( + self, + *, + default_action: Union[str, "DefaultAction"] = "Allow", + bypass: Optional[Union[str, "Bypass"]] = "AzureServices", + resource_access_rules: Optional[List["ResourceAccessRule"]] = None, + virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + ip_rules: Optional[List["IPRule"]] = None, + **kwargs + ): + """ + :keyword bypass: Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. + Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, + Metrics"), or None to bypass none of those traffics. Possible values include: "None", + "Logging", "Metrics", "AzureServices". Default value: "AzureServices". + :paramtype bypass: str or ~azure.mgmt.storage.v2021_08_01.models.Bypass + :keyword resource_access_rules: Sets the resource access rules. + :paramtype resource_access_rules: + list[~azure.mgmt.storage.v2021_08_01.models.ResourceAccessRule] + :keyword virtual_network_rules: Sets the virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.storage.v2021_08_01.models.VirtualNetworkRule] + :keyword ip_rules: Sets the IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.storage.v2021_08_01.models.IPRule] + :keyword default_action: Required. Specifies the default action of allow or deny when no other + rules match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or ~azure.mgmt.storage.v2021_08_01.models.DefaultAction + """ + super(NetworkRuleSet, self).__init__(**kwargs) + self.bypass = bypass + self.resource_access_rules = resource_access_rules + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + self.default_action = default_action + + +class ObjectReplicationPolicies(msrest.serialization.Model): + """List storage account object replication policies. + + :ivar value: The replication policy between two storage accounts. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ObjectReplicationPolicy]'}, + } + + def __init__( + self, + *, + value: Optional[List["ObjectReplicationPolicy"]] = None, + **kwargs + ): + """ + :keyword value: The replication policy between two storage accounts. + :paramtype value: list[~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy] + """ + super(ObjectReplicationPolicies, self).__init__(**kwargs) + self.value = value + + +class ObjectReplicationPolicy(Resource): + """The replication policy between two storage accounts. Multiple rules can be defined in one policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar policy_id: A unique id for object replication policy. + :vartype policy_id: str + :ivar enabled_time: Indicates when the policy is enabled on the source account. + :vartype enabled_time: ~datetime.datetime + :ivar source_account: Required. Source account name. It should be full resource id if + allowCrossTenantReplication set to false. + :vartype source_account: str + :ivar destination_account: Required. Destination account name. It should be full resource id if + allowCrossTenantReplication set to false. + :vartype destination_account: str + :ivar rules: The storage account object replication rules. + :vartype rules: list[~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicyRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_id': {'readonly': True}, + 'enabled_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, + 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, + 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, + 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, + } + + def __init__( + self, + *, + source_account: Optional[str] = None, + destination_account: Optional[str] = None, + rules: Optional[List["ObjectReplicationPolicyRule"]] = None, + **kwargs + ): + """ + :keyword source_account: Required. Source account name. It should be full resource id if + allowCrossTenantReplication set to false. + :paramtype source_account: str + :keyword destination_account: Required. Destination account name. It should be full resource id + if allowCrossTenantReplication set to false. + :paramtype destination_account: str + :keyword rules: The storage account object replication rules. + :paramtype rules: list[~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicyRule] + """ + super(ObjectReplicationPolicy, self).__init__(**kwargs) + self.policy_id = None + self.enabled_time = None + self.source_account = source_account + self.destination_account = destination_account + self.rules = rules + + +class ObjectReplicationPolicyFilter(msrest.serialization.Model): + """Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters. + + :ivar prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :vartype prefix_match: list[str] + :ivar min_creation_time: Blobs created after the time will be replicated to the destination. It + must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :vartype min_creation_time: str + """ + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, + } + + def __init__( + self, + *, + prefix_match: Optional[List[str]] = None, + min_creation_time: Optional[str] = None, + **kwargs + ): + """ + :keyword prefix_match: Optional. Filters the results to replicate only blobs whose names begin + with the specified prefix. + :paramtype prefix_match: list[str] + :keyword min_creation_time: Blobs created after the time will be replicated to the destination. + It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + :paramtype min_creation_time: str + """ + super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) + self.prefix_match = prefix_match + self.min_creation_time = min_creation_time + + +class ObjectReplicationPolicyRule(msrest.serialization.Model): + """The replication policy rule between two containers. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :vartype rule_id: str + :ivar source_container: Required. Required. Source container name. + :vartype source_container: str + :ivar destination_container: Required. Required. Destination container name. + :vartype destination_container: str + :ivar filters: Optional. An object that defines the filter set. + :vartype filters: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicyFilter + """ + + _validation = { + 'source_container': {'required': True}, + 'destination_container': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'source_container': {'key': 'sourceContainer', 'type': 'str'}, + 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, + 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, + } + + def __init__( + self, + *, + source_container: str, + destination_container: str, + rule_id: Optional[str] = None, + filters: Optional["ObjectReplicationPolicyFilter"] = None, + **kwargs + ): + """ + :keyword rule_id: Rule Id is auto-generated for each new rule on destination account. It is + required for put policy on source account. + :paramtype rule_id: str + :keyword source_container: Required. Required. Source container name. + :paramtype source_container: str + :keyword destination_container: Required. Required. Destination container name. + :paramtype destination_container: str + :keyword filters: Optional. An object that defines the filter set. + :paramtype filters: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicyFilter + """ + super(ObjectReplicationPolicyRule, self).__init__(**kwargs) + self.rule_id = rule_id + self.source_container = source_container + self.destination_container = destination_container + self.filters = filters + + +class Operation(msrest.serialization.Model): + """Storage REST API operation definition. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.storage.v2021_08_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.storage.v2021_08_01.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.storage.v2021_08_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.storage.v2021_08_01.models.ServiceSpecification + """ + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.service_specification = service_specification + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :ivar provider: Service provider: Microsoft Storage. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _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, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Service provider: Microsoft Storage. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.storage.v2021_08_01.models.Operation] + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = value + + +class PermissionScope(msrest.serialization.Model): + """PermissionScope. + + All required parameters must be populated in order to send to Azure. + + :ivar permissions: Required. The permissions for the local user. Possible values include: Read + (r), Write (w), Delete (d), List (l), and Create (c). + :vartype permissions: str + :ivar service: Required. The service used by the local user, e.g. blob, file. + :vartype service: str + :ivar resource_name: Required. The name of resource, normally the container name or the file + share name, used by the local user. + :vartype resource_name: str + """ + + _validation = { + 'permissions': {'required': True}, + 'service': {'required': True}, + 'resource_name': {'required': True}, + } + + _attribute_map = { + 'permissions': {'key': 'permissions', 'type': 'str'}, + 'service': {'key': 'service', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + permissions: str, + service: str, + resource_name: str, + **kwargs + ): + """ + :keyword permissions: Required. The permissions for the local user. Possible values include: + Read (r), Write (w), Delete (d), List (l), and Create (c). + :paramtype permissions: str + :keyword service: Required. The service used by the local user, e.g. blob, file. + :paramtype service: str + :keyword resource_name: Required. The name of resource, normally the container name or the file + share name, used by the local user. + :paramtype resource_name: str + """ + super(PermissionScope, self).__init__(**kwargs) + self.permissions = permissions + self.service = service + self.resource_name = resource_name + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :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(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.storage.v2021_08_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.storage.v2021_08_01.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.storage.v2021_08_01.models.PrivateLinkResource] + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :vartype status: str or + ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + action_required: Optional[str] = None, + **kwargs + ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.action_required = action_required + + +class ProtectedAppendWritesHistory(msrest.serialization.Model): + """Protected append writes history setting for the blob container with Legal holds. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar allow_protected_append_writes_all: When enabled, new blocks can be written to both + 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks + can be added and any existing blocks cannot be modified or deleted. + :vartype allow_protected_append_writes_all: bool + :ivar timestamp: Returns the date and time the tag was added. + :vartype timestamp: ~datetime.datetime + """ + + _validation = { + 'timestamp': {'readonly': True}, + } + + _attribute_map = { + 'allow_protected_append_writes_all': {'key': 'allowProtectedAppendWritesAll', 'type': 'bool'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + allow_protected_append_writes_all: Optional[bool] = None, + **kwargs + ): + """ + :keyword allow_protected_append_writes_all: When enabled, new blocks can be written to both + 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks + can be added and any existing blocks cannot be modified or deleted. + :paramtype allow_protected_append_writes_all: bool + """ + super(ProtectedAppendWritesHistory, self).__init__(**kwargs) + self.allow_protected_append_writes_all = allow_protected_append_writes_all + self.timestamp = None + + +class ProtocolSettings(msrest.serialization.Model): + """Protocol settings for file service. + + :ivar smb: Setting for SMB protocol. + :vartype smb: ~azure.mgmt.storage.v2021_08_01.models.SmbSetting + """ + + _attribute_map = { + 'smb': {'key': 'smb', 'type': 'SmbSetting'}, + } + + def __init__( + self, + *, + smb: Optional["SmbSetting"] = None, + **kwargs + ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_08_01.models.SmbSetting + """ + super(ProtocolSettings, self).__init__(**kwargs) + self.smb = smb + + +class QueueServiceProperties(Resource): + """The properties of a storage account’s Queue service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :vartype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, + } + + def __init__( + self, + *, + cors: Optional["CorsRules"] = None, + **kwargs + ): + """ + :keyword cors: Specifies CORS rules for the Queue service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Queue service. + :paramtype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + """ + super(QueueServiceProperties, self).__init__(**kwargs) + self.cors = cors + + +class ResourceAccessRule(msrest.serialization.Model): + """Resource Access Rule. + + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar resource_id: Resource Id. + :vartype resource_id: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ + super(ResourceAccessRule, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.resource_id = resource_id + + +class RestorePolicyProperties(msrest.serialization.Model): + """The blob service properties for blob restore policy. + + 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 enabled: Required. Blob restore is enabled if set to true. + :vartype enabled: bool + :ivar days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :vartype days: int + :ivar last_enabled_time: Deprecated in favor of minRestoreTime property. + :vartype last_enabled_time: ~datetime.datetime + :ivar min_restore_time: Returns the minimum date and time that the restore can be started. + :vartype min_restore_time: ~datetime.datetime + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'maximum': 365, 'minimum': 1}, + 'last_enabled_time': {'readonly': True}, + 'min_restore_time': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, + 'min_restore_time': {'key': 'minRestoreTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + enabled: bool, + days: Optional[int] = None, + **kwargs + ): + """ + :keyword enabled: Required. Blob restore is enabled if set to true. + :paramtype enabled: bool + :keyword days: how long this blob can be restored. It should be great than zero and less than + DeleteRetentionPolicy.days. + :paramtype days: int + """ + super(RestorePolicyProperties, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + self.last_enabled_time = None + self.min_restore_time = None + + +class Restriction(msrest.serialization.Model): + """The restriction because of which SKU cannot be used. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of restrictions. As of now only possible value for this is location. + :vartype type: str + :ivar values: The value of restrictions. If the restriction type is set to location. This would + be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :vartype reason_code: str or ~azure.mgmt.storage.v2021_08_01.models.ReasonCode + """ + + _validation = { + 'type': {'readonly': True}, + 'values': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'reason_code': {'key': 'reasonCode', 'type': 'str'}, + } + + def __init__( + self, + *, + reason_code: Optional[Union[str, "ReasonCode"]] = None, + **kwargs + ): + """ + :keyword reason_code: The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. Possible values include: "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.storage.v2021_08_01.models.ReasonCode + """ + super(Restriction, self).__init__(**kwargs) + self.type = None + self.values = None + self.reason_code = reason_code + + +class RoutingPreference(msrest.serialization.Model): + """Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing. + + :ivar routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :vartype routing_choice: str or ~azure.mgmt.storage.v2021_08_01.models.RoutingChoice + :ivar publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :vartype publish_microsoft_endpoints: bool + :ivar publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :vartype publish_internet_endpoints: bool + """ + + _attribute_map = { + 'routing_choice': {'key': 'routingChoice', 'type': 'str'}, + 'publish_microsoft_endpoints': {'key': 'publishMicrosoftEndpoints', 'type': 'bool'}, + 'publish_internet_endpoints': {'key': 'publishInternetEndpoints', 'type': 'bool'}, + } + + def __init__( + self, + *, + routing_choice: Optional[Union[str, "RoutingChoice"]] = None, + publish_microsoft_endpoints: Optional[bool] = None, + publish_internet_endpoints: Optional[bool] = None, + **kwargs + ): + """ + :keyword routing_choice: Routing Choice defines the kind of network routing opted by the user. + Possible values include: "MicrosoftRouting", "InternetRouting". + :paramtype routing_choice: str or ~azure.mgmt.storage.v2021_08_01.models.RoutingChoice + :keyword publish_microsoft_endpoints: A boolean flag which indicates whether microsoft routing + storage endpoints are to be published. + :paramtype publish_microsoft_endpoints: bool + :keyword publish_internet_endpoints: A boolean flag which indicates whether internet routing + storage endpoints are to be published. + :paramtype publish_internet_endpoints: bool + """ + super(RoutingPreference, self).__init__(**kwargs) + self.routing_choice = routing_choice + self.publish_microsoft_endpoints = publish_microsoft_endpoints + self.publish_internet_endpoints = publish_internet_endpoints + + +class SasPolicy(msrest.serialization.Model): + """SasPolicy assigned to the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :vartype sas_expiration_period: str + :ivar expiration_action: Required. The SAS expiration action. Can only be Log. Possible values + include: "Log". Default value: "Log". + :vartype expiration_action: str or ~azure.mgmt.storage.v2021_08_01.models.ExpirationAction + """ + + _validation = { + 'sas_expiration_period': {'required': True}, + 'expiration_action': {'required': True}, + } + + _attribute_map = { + 'sas_expiration_period': {'key': 'sasExpirationPeriod', 'type': 'str'}, + 'expiration_action': {'key': 'expirationAction', 'type': 'str'}, + } + + def __init__( + self, + *, + sas_expiration_period: str, + expiration_action: Union[str, "ExpirationAction"] = "Log", + **kwargs + ): + """ + :keyword sas_expiration_period: Required. The SAS expiration period, DD.HH:MM:SS. + :paramtype sas_expiration_period: str + :keyword expiration_action: Required. The SAS expiration action. Can only be Log. Possible + values include: "Log". Default value: "Log". + :paramtype expiration_action: str or ~azure.mgmt.storage.v2021_08_01.models.ExpirationAction + """ + super(SasPolicy, self).__init__(**kwargs) + self.sas_expiration_period = sas_expiration_period + self.expiration_action = expiration_action + + +class ServiceSasParameters(msrest.serialization.Model): + """The parameters to list service SAS credentials of a specific resource. + + All required parameters must be populated in order to send to Azure. + + :ivar canonicalized_resource: Required. The canonical path to the signed resource. + :vartype canonicalized_resource: str + :ivar resource: The signed services accessible with the service SAS. Possible values include: + Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", "s". + :vartype resource: str or ~azure.mgmt.storage.v2021_08_01.models.SignedResource + :ivar permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :vartype permissions: str or ~azure.mgmt.storage.v2021_08_01.models.Permissions + :ivar ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :vartype ip_address_or_range: str + :ivar protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :vartype protocols: str or ~azure.mgmt.storage.v2021_08_01.models.HttpProtocol + :ivar shared_access_start_time: The time at which the SAS becomes valid. + :vartype shared_access_start_time: ~datetime.datetime + :ivar shared_access_expiry_time: The time at which the shared access signature becomes invalid. + :vartype shared_access_expiry_time: ~datetime.datetime + :ivar identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :vartype identifier: str + :ivar partition_key_start: The start of partition key. + :vartype partition_key_start: str + :ivar partition_key_end: The end of partition key. + :vartype partition_key_end: str + :ivar row_key_start: The start of row key. + :vartype row_key_start: str + :ivar row_key_end: The end of row key. + :vartype row_key_end: str + :ivar key_to_sign: The key to sign the account SAS token with. + :vartype key_to_sign: str + :ivar cache_control: The response header override for cache control. + :vartype cache_control: str + :ivar content_disposition: The response header override for content disposition. + :vartype content_disposition: str + :ivar content_encoding: The response header override for content encoding. + :vartype content_encoding: str + :ivar content_language: The response header override for content language. + :vartype content_language: str + :ivar content_type: The response header override for content type. + :vartype content_type: str + """ + + _validation = { + 'canonicalized_resource': {'required': True}, + 'identifier': {'max_length': 64, 'min_length': 0}, + } + + _attribute_map = { + 'canonicalized_resource': {'key': 'canonicalizedResource', 'type': 'str'}, + 'resource': {'key': 'signedResource', 'type': 'str'}, + 'permissions': {'key': 'signedPermission', 'type': 'str'}, + 'ip_address_or_range': {'key': 'signedIp', 'type': 'str'}, + 'protocols': {'key': 'signedProtocol', 'type': 'str'}, + 'shared_access_start_time': {'key': 'signedStart', 'type': 'iso-8601'}, + 'shared_access_expiry_time': {'key': 'signedExpiry', 'type': 'iso-8601'}, + 'identifier': {'key': 'signedIdentifier', 'type': 'str'}, + 'partition_key_start': {'key': 'startPk', 'type': 'str'}, + 'partition_key_end': {'key': 'endPk', 'type': 'str'}, + 'row_key_start': {'key': 'startRk', 'type': 'str'}, + 'row_key_end': {'key': 'endRk', 'type': 'str'}, + 'key_to_sign': {'key': 'keyToSign', 'type': 'str'}, + 'cache_control': {'key': 'rscc', 'type': 'str'}, + 'content_disposition': {'key': 'rscd', 'type': 'str'}, + 'content_encoding': {'key': 'rsce', 'type': 'str'}, + 'content_language': {'key': 'rscl', 'type': 'str'}, + 'content_type': {'key': 'rsct', 'type': 'str'}, + } + + def __init__( + self, + *, + canonicalized_resource: str, + resource: Optional[Union[str, "SignedResource"]] = None, + permissions: Optional[Union[str, "Permissions"]] = None, + ip_address_or_range: Optional[str] = None, + protocols: Optional[Union[str, "HttpProtocol"]] = None, + shared_access_start_time: Optional[datetime.datetime] = None, + shared_access_expiry_time: Optional[datetime.datetime] = None, + identifier: Optional[str] = None, + partition_key_start: Optional[str] = None, + partition_key_end: Optional[str] = None, + row_key_start: Optional[str] = None, + row_key_end: Optional[str] = None, + key_to_sign: Optional[str] = None, + cache_control: Optional[str] = None, + content_disposition: Optional[str] = None, + content_encoding: Optional[str] = None, + content_language: Optional[str] = None, + content_type: Optional[str] = None, + **kwargs + ): + """ + :keyword canonicalized_resource: Required. The canonical path to the signed resource. + :paramtype canonicalized_resource: str + :keyword resource: The signed services accessible with the service SAS. Possible values + include: Blob (b), Container (c), File (f), Share (s). Possible values include: "b", "c", "f", + "s". + :paramtype resource: str or ~azure.mgmt.storage.v2021_08_01.models.SignedResource + :keyword permissions: The signed permissions for the service SAS. Possible values include: Read + (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible + values include: "r", "d", "w", "l", "a", "c", "u", "p". + :paramtype permissions: str or ~azure.mgmt.storage.v2021_08_01.models.Permissions + :keyword ip_address_or_range: An IP address or a range of IP addresses from which to accept + requests. + :paramtype ip_address_or_range: str + :keyword protocols: The protocol permitted for a request made with the account SAS. Possible + values include: "https,http", "https". + :paramtype protocols: str or ~azure.mgmt.storage.v2021_08_01.models.HttpProtocol + :keyword shared_access_start_time: The time at which the SAS becomes valid. + :paramtype shared_access_start_time: ~datetime.datetime + :keyword shared_access_expiry_time: The time at which the shared access signature becomes + invalid. + :paramtype shared_access_expiry_time: ~datetime.datetime + :keyword identifier: A unique value up to 64 characters in length that correlates to an access + policy specified for the container, queue, or table. + :paramtype identifier: str + :keyword partition_key_start: The start of partition key. + :paramtype partition_key_start: str + :keyword partition_key_end: The end of partition key. + :paramtype partition_key_end: str + :keyword row_key_start: The start of row key. + :paramtype row_key_start: str + :keyword row_key_end: The end of row key. + :paramtype row_key_end: str + :keyword key_to_sign: The key to sign the account SAS token with. + :paramtype key_to_sign: str + :keyword cache_control: The response header override for cache control. + :paramtype cache_control: str + :keyword content_disposition: The response header override for content disposition. + :paramtype content_disposition: str + :keyword content_encoding: The response header override for content encoding. + :paramtype content_encoding: str + :keyword content_language: The response header override for content language. + :paramtype content_language: str + :keyword content_type: The response header override for content type. + :paramtype content_type: str + """ + super(ServiceSasParameters, self).__init__(**kwargs) + self.canonicalized_resource = canonicalized_resource + self.resource = resource + self.permissions = permissions + self.ip_address_or_range = ip_address_or_range + self.protocols = protocols + self.shared_access_start_time = shared_access_start_time + self.shared_access_expiry_time = shared_access_expiry_time + self.identifier = identifier + self.partition_key_start = partition_key_start + self.partition_key_end = partition_key_end + self.row_key_start = row_key_start + self.row_key_end = row_key_end + self.key_to_sign = key_to_sign + self.cache_control = cache_control + self.content_disposition = content_disposition + self.content_encoding = content_encoding + self.content_language = content_language + self.content_type = content_type + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include metric specifications. + + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.storage.v2021_08_01.models.MetricSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.storage.v2021_08_01.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + + +class SignedIdentifier(msrest.serialization.Model): + """SignedIdentifier. + + :ivar id: An unique identifier of the stored access policy. + :vartype id: str + :ivar access_policy: Access policy. + :vartype access_policy: ~azure.mgmt.storage.v2021_08_01.models.AccessPolicy + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'access_policy': {'key': 'accessPolicy', 'type': 'AccessPolicy'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + access_policy: Optional["AccessPolicy"] = None, + **kwargs + ): + """ + :keyword id: An unique identifier of the stored access policy. + :paramtype id: str + :keyword access_policy: Access policy. + :paramtype access_policy: ~azure.mgmt.storage.v2021_08_01.models.AccessPolicy + """ + super(SignedIdentifier, self).__init__(**kwargs) + self.id = id + self.access_policy = access_policy + + +class Sku(msrest.serialization.Model): + """The SKU of the storage account. + + 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 SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :vartype name: str or ~azure.mgmt.storage.v2021_08_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", + "Premium". + :vartype tier: str or ~azure.mgmt.storage.v2021_08_01.models.SkuTier + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_08_01.models.SkuName + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class SKUCapability(msrest.serialization.Model): + """The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of capability, The capability information in the specified SKU, including + file encryption, network ACLs, change notification, etc. + :vartype name: str + :ivar value: A string value to indicate states of given capability. Possibly 'true' or 'false'. + :vartype value: str + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SKUCapability, self).__init__(**kwargs) + self.name = None + self.value = None + + +class SkuInformation(msrest.serialization.Model): + """Storage SKU and its 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 name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :vartype name: str or ~azure.mgmt.storage.v2021_08_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard", + "Premium". + :vartype tier: str or ~azure.mgmt.storage.v2021_08_01.models.SkuTier + :ivar resource_type: The type of the resource, usually it is 'storageAccounts'. + :vartype resource_type: str + :ivar kind: Indicates the type of storage account. Possible values include: "Storage", + "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_08_01.models.Kind + :ivar locations: The set of locations that the SKU is available. This will be supported and + registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). + :vartype locations: list[str] + :ivar capabilities: The capability information in the specified SKU, including file encryption, + network ACLs, change notification, etc. + :vartype capabilities: list[~azure.mgmt.storage.v2021_08_01.models.SKUCapability] + :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :vartype restrictions: list[~azure.mgmt.storage.v2021_08_01.models.Restriction] + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'kind': {'readonly': True}, + 'locations': {'readonly': True}, + 'capabilities': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, + 'restrictions': {'key': 'restrictions', 'type': '[Restriction]'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + restrictions: Optional[List["Restriction"]] = None, + **kwargs + ): + """ + :keyword name: Required. The SKU name. Required for account creation; optional for update. Note + that in older versions, SKU name was called accountType. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", + "Standard_GZRS", "Standard_RAGZRS". + :paramtype name: str or ~azure.mgmt.storage.v2021_08_01.models.SkuName + :keyword restrictions: The restrictions because of which SKU cannot be used. This is empty if + there are no restrictions. + :paramtype restrictions: list[~azure.mgmt.storage.v2021_08_01.models.Restriction] + """ + super(SkuInformation, self).__init__(**kwargs) + self.name = name + self.tier = None + self.resource_type = None + self.kind = None + self.locations = None + self.capabilities = None + self.restrictions = restrictions + + +class SmbSetting(msrest.serialization.Model): + """Setting for SMB protocol. + + :ivar multichannel: Multichannel setting. Applies to Premium FileStorage only. + :vartype multichannel: ~azure.mgmt.storage.v2021_08_01.models.Multichannel + :ivar versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + SMB3.1.1. Should be passed as a string with delimiter ';'. + :vartype versions: str + :ivar authentication_methods: SMB authentication methods supported by server. Valid values are + NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + :vartype authentication_methods: str + :ivar kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid values + are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. + :vartype kerberos_ticket_encryption: str + :ivar channel_encryption: SMB channel encryption supported by server. Valid values are + AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + :vartype channel_encryption: str + """ + + _attribute_map = { + 'multichannel': {'key': 'multichannel', 'type': 'Multichannel'}, + 'versions': {'key': 'versions', 'type': 'str'}, + 'authentication_methods': {'key': 'authenticationMethods', 'type': 'str'}, + 'kerberos_ticket_encryption': {'key': 'kerberosTicketEncryption', 'type': 'str'}, + 'channel_encryption': {'key': 'channelEncryption', 'type': 'str'}, + } + + def __init__( + self, + *, + multichannel: Optional["Multichannel"] = None, + versions: Optional[str] = None, + authentication_methods: Optional[str] = None, + kerberos_ticket_encryption: Optional[str] = None, + channel_encryption: Optional[str] = None, + **kwargs + ): + """ + :keyword multichannel: Multichannel setting. Applies to Premium FileStorage only. + :paramtype multichannel: ~azure.mgmt.storage.v2021_08_01.models.Multichannel + :keyword versions: SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, + SMB3.1.1. Should be passed as a string with delimiter ';'. + :paramtype versions: str + :keyword authentication_methods: SMB authentication methods supported by server. Valid values + are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + :paramtype authentication_methods: str + :keyword kerberos_ticket_encryption: Kerberos ticket encryption supported by server. Valid + values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'. + :paramtype kerberos_ticket_encryption: str + :keyword channel_encryption: SMB channel encryption supported by server. Valid values are + AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + :paramtype channel_encryption: str + """ + super(SmbSetting, self).__init__(**kwargs) + self.multichannel = multichannel + self.versions = versions + self.authentication_methods = authentication_methods + self.kerberos_ticket_encryption = kerberos_ticket_encryption + self.channel_encryption = channel_encryption + + +class SshPublicKey(msrest.serialization.Model): + """SshPublicKey. + + :ivar description: Optional. It is used to store the function/usage of the key. + :vartype description: str + :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :code:``', e.g. ssh-rsa AAAABBBB. + :vartype key: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + key: Optional[str] = None, + **kwargs + ): + """ + :keyword description: Optional. It is used to store the function/usage of the key. + :paramtype description: str + :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :code:``', e.g. ssh-rsa AAAABBBB. + :paramtype key: str + """ + super(SshPublicKey, self).__init__(**kwargs) + self.description = description + self.key = key + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class StorageAccount(TrackedResource): + """The storage account. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar sku: Gets the SKU. + :vartype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :ivar kind: Gets the Kind. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_08_01.models.Kind + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_08_01.models.Identity + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.storage.v2021_08_01.models.ExtendedLocation + :ivar provisioning_state: Gets the status of the storage account at the time the operation was + called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + :vartype provisioning_state: str or ~azure.mgmt.storage.v2021_08_01.models.ProvisioningState + :ivar primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, + queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob + endpoint. + :vartype primary_endpoints: ~azure.mgmt.storage.v2021_08_01.models.Endpoints + :ivar primary_location: Gets the location of the primary data center for the storage account. + :vartype primary_location: str + :ivar status_of_primary: Gets the status indicating whether the primary location of the storage + account is available or unavailable. Possible values include: "available", "unavailable". + :vartype status_of_primary: str or ~azure.mgmt.storage.v2021_08_01.models.AccountStatus + :ivar last_geo_failover_time: Gets the timestamp of the most recent instance of a failover to + the secondary location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the accountType is + Standard_GRS or Standard_RAGRS. + :vartype last_geo_failover_time: ~datetime.datetime + :ivar secondary_location: Gets the location of the geo-replicated secondary for the storage + account. Only available if the accountType is Standard_GRS or Standard_RAGRS. + :vartype secondary_location: str + :ivar status_of_secondary: Gets the status indicating whether the secondary location of the + storage account is available or unavailable. Only available if the SKU name is Standard_GRS or + Standard_RAGRS. Possible values include: "available", "unavailable". + :vartype status_of_secondary: str or ~azure.mgmt.storage.v2021_08_01.models.AccountStatus + :ivar creation_time: Gets the creation date and time of the storage account in UTC. + :vartype creation_time: ~datetime.datetime + :ivar custom_domain: Gets the custom domain the user assigned to this storage account. + :vartype custom_domain: ~azure.mgmt.storage.v2021_08_01.models.CustomDomain + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_08_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_08_01.models.KeyPolicy + :ivar key_creation_time: Storage account keys creation time. + :vartype key_creation_time: ~azure.mgmt.storage.v2021_08_01.models.KeyCreationTime + :ivar secondary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, + queue, or table object from the secondary location of the storage account. Only available if + the SKU name is Standard_RAGRS. + :vartype secondary_endpoints: ~azure.mgmt.storage.v2021_08_01.models.Endpoints + :ivar encryption: Encryption settings to be used for server-side encryption for the storage + account. + :vartype encryption: ~azure.mgmt.storage.v2021_08_01.models.Encryption + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :vartype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_08_01.models.AzureFilesIdentityBasedAuthentication + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_08_01.models.NetworkRuleSet + :ivar is_sftp_enabled: Enables Secure File Transfer Protocol, if set to true. + :vartype is_sftp_enabled: bool + :ivar is_local_user_enabled: Enables local users feature, if set to true. + :vartype is_local_user_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar geo_replication_stats: Geo Replication Stats. + :vartype geo_replication_stats: ~azure.mgmt.storage.v2021_08_01.models.GeoReplicationStats + :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, + it will be null. + :vartype failover_in_progress: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :vartype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_08_01.models.LargeFileSharesState + :ivar private_endpoint_connections: List of private endpoint connection associated with the + specified storage account. + :vartype private_endpoint_connections: + list[~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection] + :ivar routing_preference: Maintains information about the network routing choice opted by the + user for data transfer. + :vartype routing_preference: ~azure.mgmt.storage.v2021_08_01.models.RoutingPreference + :ivar blob_restore_status: Blob restore status. + :vartype blob_restore_status: ~azure.mgmt.storage.v2021_08_01.models.BlobRestoreStatus + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in + the storage account. The default interpretation is true for this property. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", + "TLS1_1", "TLS1_2". + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_08_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :vartype allow_cross_tenant_replication: bool + :ivar default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :vartype default_to_o_auth_authentication: bool + :ivar public_network_access: Allow or disallow public network access to Storage Account. Value + is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.storage.v2021_08_01.models.PublicNetworkAccess + :ivar immutable_storage_with_versioning: The property is immutable and can only be set to true + at the account creation time. When set to true, it enables object level immutability for all + the containers in the account by default. + :vartype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageAccount + :ivar allowed_copy_scope: Restrict copy to and from Storage Accounts within an AAD tenant or + with Private Links to the same VNet. Possible values include: "PrivateLink", "AAD". + :vartype allowed_copy_scope: str or ~azure.mgmt.storage.v2021_08_01.models.AllowedCopyScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'readonly': True}, + 'kind': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'primary_endpoints': {'readonly': True}, + 'primary_location': {'readonly': True}, + 'status_of_primary': {'readonly': True}, + 'last_geo_failover_time': {'readonly': True}, + 'secondary_location': {'readonly': True}, + 'status_of_secondary': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'custom_domain': {'readonly': True}, + 'sas_policy': {'readonly': True}, + 'key_policy': {'readonly': True}, + 'key_creation_time': {'readonly': True}, + 'secondary_endpoints': {'readonly': True}, + 'encryption': {'readonly': True}, + 'access_tier': {'readonly': True}, + 'network_rule_set': {'readonly': True}, + 'geo_replication_stats': {'readonly': True}, + 'failover_in_progress': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'blob_restore_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, + 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, + 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, + 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, + 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, + 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, + 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, + 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, + 'key_creation_time': {'key': 'properties.keyCreationTime', 'type': 'KeyCreationTime'}, + 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, + 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, + 'is_sftp_enabled': {'key': 'properties.isSftpEnabled', 'type': 'bool'}, + 'is_local_user_enabled': {'key': 'properties.isLocalUserEnabled', 'type': 'bool'}, + 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, + 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, + 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, + 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, + 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, + 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, + 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, + 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, + 'default_to_o_auth_authentication': {'key': 'properties.defaultToOAuthAuthentication', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageAccount'}, + 'allowed_copy_scope': {'key': 'properties.allowedCopyScope', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["Identity"] = None, + extended_location: Optional["ExtendedLocation"] = None, + azure_files_identity_based_authentication: Optional["AzureFilesIdentityBasedAuthentication"] = None, + enable_https_traffic_only: Optional[bool] = None, + is_sftp_enabled: Optional[bool] = None, + is_local_user_enabled: Optional[bool] = None, + is_hns_enabled: Optional[bool] = None, + large_file_shares_state: Optional[Union[str, "LargeFileSharesState"]] = None, + routing_preference: Optional["RoutingPreference"] = None, + allow_blob_public_access: Optional[bool] = None, + minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, + allow_shared_key_access: Optional[bool] = None, + enable_nfs_v3: Optional[bool] = None, + allow_cross_tenant_replication: Optional[bool] = None, + default_to_o_auth_authentication: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + immutable_storage_with_versioning: Optional["ImmutableStorageAccount"] = None, + allowed_copy_scope: Optional[Union[str, "AllowedCopyScope"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_08_01.models.Identity + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.storage.v2021_08_01.models.ExtendedLocation + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_08_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_sftp_enabled: Enables Secure File Transfer Protocol, if set to true. + :paramtype is_sftp_enabled: bool + :keyword is_local_user_enabled: Enables local users feature, if set to true. + :paramtype is_local_user_enabled: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_08_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_08_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_08_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + :keyword default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :paramtype default_to_o_auth_authentication: bool + :keyword public_network_access: Allow or disallow public network access to Storage Account. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.storage.v2021_08_01.models.PublicNetworkAccess + :keyword immutable_storage_with_versioning: The property is immutable and can only be set to + true at the account creation time. When set to true, it enables object level immutability for + all the containers in the account by default. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageAccount + :keyword allowed_copy_scope: Restrict copy to and from Storage Accounts within an AAD tenant or + with Private Links to the same VNet. Possible values include: "PrivateLink", "AAD". + :paramtype allowed_copy_scope: str or ~azure.mgmt.storage.v2021_08_01.models.AllowedCopyScope + """ + super(StorageAccount, self).__init__(tags=tags, location=location, **kwargs) + self.sku = None + self.kind = None + self.identity = identity + self.extended_location = extended_location + self.provisioning_state = None + self.primary_endpoints = None + self.primary_location = None + self.status_of_primary = None + self.last_geo_failover_time = None + self.secondary_location = None + self.status_of_secondary = None + self.creation_time = None + self.custom_domain = None + self.sas_policy = None + self.key_policy = None + self.key_creation_time = None + self.secondary_endpoints = None + self.encryption = None + self.access_tier = None + self.azure_files_identity_based_authentication = azure_files_identity_based_authentication + self.enable_https_traffic_only = enable_https_traffic_only + self.network_rule_set = None + self.is_sftp_enabled = is_sftp_enabled + self.is_local_user_enabled = is_local_user_enabled + self.is_hns_enabled = is_hns_enabled + self.geo_replication_stats = None + self.failover_in_progress = None + self.large_file_shares_state = large_file_shares_state + self.private_endpoint_connections = None + self.routing_preference = routing_preference + self.blob_restore_status = None + self.allow_blob_public_access = allow_blob_public_access + self.minimum_tls_version = minimum_tls_version + self.allow_shared_key_access = allow_shared_key_access + self.enable_nfs_v3 = enable_nfs_v3 + self.allow_cross_tenant_replication = allow_cross_tenant_replication + self.default_to_o_auth_authentication = default_to_o_auth_authentication + self.public_network_access = public_network_access + self.immutable_storage_with_versioning = immutable_storage_with_versioning + self.allowed_copy_scope = allowed_copy_scope + + +class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): + """The parameters used to check the availability of the storage account name. + + 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 storage account name. + :vartype name: str + :ivar type: The type of resource, Microsoft.Storage/storageAccounts. Has constant value: + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Storage/storageAccounts" + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ + super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class StorageAccountCreateParameters(msrest.serialization.Model): + """The parameters used when creating a storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar sku: Required. Required. Gets or sets the SKU name. + :vartype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :ivar kind: Required. Required. Indicates the type of storage account. Possible values include: + "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_08_01.models.Kind + :ivar location: Required. Required. Gets or sets the location of the resource. This will be one + of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :vartype location: str + :ivar extended_location: Optional. Set the extended location of the resource. If not set, the + storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :vartype extended_location: ~azure.mgmt.storage.v2021_08_01.models.ExtendedLocation + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + These tags can be used for viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no + greater than 128 characters and a value with a length no greater than 256 characters. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_08_01.models.Identity + :ivar allowed_copy_scope: Restrict copy to and from Storage Accounts within an AAD tenant or + with Private Links to the same VNet. Possible values include: "PrivateLink", "AAD". + :vartype allowed_copy_scope: str or ~azure.mgmt.storage.v2021_08_01.models.AllowedCopyScope + :ivar public_network_access: Allow or disallow public network access to Storage Account. Value + is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.storage.v2021_08_01.models.PublicNetworkAccess + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_08_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_08_01.models.KeyPolicy + :ivar custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :vartype custom_domain: ~azure.mgmt.storage.v2021_08_01.models.CustomDomain + :ivar encryption: Encryption settings to be used for server-side encryption for the storage + account. + :vartype encryption: ~azure.mgmt.storage.v2021_08_01.models.Encryption + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_08_01.models.NetworkRuleSet + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :vartype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_08_01.models.AzureFilesIdentityBasedAuthentication + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + The default value is true since API version 2019-04-01. + :vartype enable_https_traffic_only: bool + :ivar is_sftp_enabled: Enables Secure File Transfer Protocol, if set to true. + :vartype is_sftp_enabled: bool + :ivar is_local_user_enabled: Enables local users feature, if set to true. + :vartype is_local_user_enabled: bool + :ivar is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :vartype is_hns_enabled: bool + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :vartype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_08_01.models.LargeFileSharesState + :ivar routing_preference: Maintains information about the network routing choice opted by the + user for data transfer. + :vartype routing_preference: ~azure.mgmt.storage.v2021_08_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in + the storage account. The default interpretation is true for this property. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", + "TLS1_1", "TLS1_2". + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_08_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :vartype allow_shared_key_access: bool + :ivar enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :vartype enable_nfs_v3: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :vartype allow_cross_tenant_replication: bool + :ivar default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :vartype default_to_o_auth_authentication: bool + :ivar immutable_storage_with_versioning: The property is immutable and can only be set to true + at the account creation time. When set to true, it enables object level immutability for all + the new containers in the account by default. + :vartype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageAccount + """ + + _validation = { + 'sku': {'required': True}, + 'kind': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'allowed_copy_scope': {'key': 'properties.allowedCopyScope', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, + 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, + 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, + 'is_sftp_enabled': {'key': 'properties.isSftpEnabled', 'type': 'bool'}, + 'is_local_user_enabled': {'key': 'properties.isLocalUserEnabled', 'type': 'bool'}, + 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, + 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, + 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, + 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, + 'enable_nfs_v3': {'key': 'properties.isNfsV3Enabled', 'type': 'bool'}, + 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, + 'default_to_o_auth_authentication': {'key': 'properties.defaultToOAuthAuthentication', 'type': 'bool'}, + 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageAccount'}, + } + + def __init__( + self, + *, + sku: "Sku", + kind: Union[str, "Kind"], + location: str, + extended_location: Optional["ExtendedLocation"] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["Identity"] = None, + allowed_copy_scope: Optional[Union[str, "AllowedCopyScope"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + sas_policy: Optional["SasPolicy"] = None, + key_policy: Optional["KeyPolicy"] = None, + custom_domain: Optional["CustomDomain"] = None, + encryption: Optional["Encryption"] = None, + network_rule_set: Optional["NetworkRuleSet"] = None, + access_tier: Optional[Union[str, "AccessTier"]] = None, + azure_files_identity_based_authentication: Optional["AzureFilesIdentityBasedAuthentication"] = None, + enable_https_traffic_only: Optional[bool] = None, + is_sftp_enabled: Optional[bool] = None, + is_local_user_enabled: Optional[bool] = None, + is_hns_enabled: Optional[bool] = None, + large_file_shares_state: Optional[Union[str, "LargeFileSharesState"]] = None, + routing_preference: Optional["RoutingPreference"] = None, + allow_blob_public_access: Optional[bool] = None, + minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, + allow_shared_key_access: Optional[bool] = None, + enable_nfs_v3: Optional[bool] = None, + allow_cross_tenant_replication: Optional[bool] = None, + default_to_o_auth_authentication: Optional[bool] = None, + immutable_storage_with_versioning: Optional["ImmutableStorageAccount"] = None, + **kwargs + ): + """ + :keyword sku: Required. Required. Gets or sets the SKU name. + :paramtype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :keyword kind: Required. Required. Indicates the type of storage account. Possible values + include: "Storage", "StorageV2", "BlobStorage", "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_08_01.models.Kind + :keyword location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. + :paramtype location: str + :keyword extended_location: Optional. Set the extended location of the resource. If not set, + the storage account will be created in Azure main region. Otherwise it will be created in the + specified extended location. + :paramtype extended_location: ~azure.mgmt.storage.v2021_08_01.models.ExtendedLocation + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used for viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a + length no greater than 128 characters and a value with a length no greater than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_08_01.models.Identity + :keyword allowed_copy_scope: Restrict copy to and from Storage Accounts within an AAD tenant or + with Private Links to the same VNet. Possible values include: "PrivateLink", "AAD". + :paramtype allowed_copy_scope: str or ~azure.mgmt.storage.v2021_08_01.models.AllowedCopyScope + :keyword public_network_access: Allow or disallow public network access to Storage Account. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.storage.v2021_08_01.models.PublicNetworkAccess + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_08_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_08_01.models.KeyPolicy + :keyword custom_domain: User domain assigned to the storage account. Name is the CNAME source. + Only one custom domain is supported per storage account at this time. To clear the existing + custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_08_01.models.CustomDomain + :keyword encryption: Encryption settings to be used for server-side encryption for the storage + account. + :paramtype encryption: ~azure.mgmt.storage.v2021_08_01.models.Encryption + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_08_01.models.NetworkRuleSet + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_08_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. The default value is true since API version 2019-04-01. + :paramtype enable_https_traffic_only: bool + :keyword is_sftp_enabled: Enables Secure File Transfer Protocol, if set to true. + :paramtype is_sftp_enabled: bool + :keyword is_local_user_enabled: Enables local users feature, if set to true. + :paramtype is_local_user_enabled: bool + :keyword is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. + :paramtype is_hns_enabled: bool + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_08_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_08_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_08_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword enable_nfs_v3: NFS 3.0 protocol support enabled if set to true. + :paramtype enable_nfs_v3: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + :keyword default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :paramtype default_to_o_auth_authentication: bool + :keyword immutable_storage_with_versioning: The property is immutable and can only be set to + true at the account creation time. When set to true, it enables object level immutability for + all the new containers in the account by default. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageAccount + """ + super(StorageAccountCreateParameters, self).__init__(**kwargs) + self.sku = sku + self.kind = kind + self.location = location + self.extended_location = extended_location + self.tags = tags + self.identity = identity + self.allowed_copy_scope = allowed_copy_scope + self.public_network_access = public_network_access + self.sas_policy = sas_policy + self.key_policy = key_policy + self.custom_domain = custom_domain + self.encryption = encryption + self.network_rule_set = network_rule_set + self.access_tier = access_tier + self.azure_files_identity_based_authentication = azure_files_identity_based_authentication + self.enable_https_traffic_only = enable_https_traffic_only + self.is_sftp_enabled = is_sftp_enabled + self.is_local_user_enabled = is_local_user_enabled + self.is_hns_enabled = is_hns_enabled + self.large_file_shares_state = large_file_shares_state + self.routing_preference = routing_preference + self.allow_blob_public_access = allow_blob_public_access + self.minimum_tls_version = minimum_tls_version + self.allow_shared_key_access = allow_shared_key_access + self.enable_nfs_v3 = enable_nfs_v3 + self.allow_cross_tenant_replication = allow_cross_tenant_replication + self.default_to_o_auth_authentication = default_to_o_auth_authentication + self.immutable_storage_with_versioning = immutable_storage_with_versioning + + +class StorageAccountInternetEndpoints(msrest.serialization.Model): + """The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via a internet routing endpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar blob: Gets the blob endpoint. + :vartype blob: str + :ivar file: Gets the file endpoint. + :vartype file: str + :ivar web: Gets the web endpoint. + :vartype web: str + :ivar dfs: Gets the dfs endpoint. + :vartype dfs: str + """ + + _validation = { + 'blob': {'readonly': True}, + 'file': {'readonly': True}, + 'web': {'readonly': True}, + 'dfs': {'readonly': True}, + } + + _attribute_map = { + 'blob': {'key': 'blob', 'type': 'str'}, + 'file': {'key': 'file', 'type': 'str'}, + 'web': {'key': 'web', 'type': 'str'}, + 'dfs': {'key': 'dfs', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountInternetEndpoints, self).__init__(**kwargs) + self.blob = None + self.file = None + self.web = None + self.dfs = None + + +class StorageAccountKey(msrest.serialization.Model): + """An access key for the storage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key_name: Name of the key. + :vartype key_name: str + :ivar value: Base 64-encoded value of the key. + :vartype value: str + :ivar permissions: Permissions for the key -- read-only or full permissions. Possible values + include: "Read", "Full". + :vartype permissions: str or ~azure.mgmt.storage.v2021_08_01.models.KeyPermission + :ivar creation_time: Creation time of the key, in round trip date format. + :vartype creation_time: ~datetime.datetime + """ + + _validation = { + 'key_name': {'readonly': True}, + 'value': {'readonly': True}, + 'permissions': {'readonly': True}, + 'creation_time': {'readonly': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'str'}, + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountKey, self).__init__(**kwargs) + self.key_name = None + self.value = None + self.permissions = None + self.creation_time = None + + +class StorageAccountListKeysResult(msrest.serialization.Model): + """The response from the ListKeys operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar keys: Gets the list of storage account keys and their properties for the specified + storage account. + :vartype keys: list[~azure.mgmt.storage.v2021_08_01.models.StorageAccountKey] + """ + + _validation = { + 'keys': {'readonly': True}, + } + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[StorageAccountKey]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountListKeysResult, self).__init__(**kwargs) + self.keys = None + + +class StorageAccountListResult(msrest.serialization.Model): + """The response from the List Storage Accounts operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Gets the list of storage accounts and their properties. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.StorageAccount] + :ivar next_link: Request URL that can be used to query next page of storage accounts. Returned + when total number of requested storage accounts exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class StorageAccountMicrosoftEndpoints(msrest.serialization.Model): + """The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object via a microsoft routing endpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar blob: Gets the blob endpoint. + :vartype blob: str + :ivar queue: Gets the queue endpoint. + :vartype queue: str + :ivar table: Gets the table endpoint. + :vartype table: str + :ivar file: Gets the file endpoint. + :vartype file: str + :ivar web: Gets the web endpoint. + :vartype web: str + :ivar dfs: Gets the dfs endpoint. + :vartype dfs: str + """ + + _validation = { + 'blob': {'readonly': True}, + 'queue': {'readonly': True}, + 'table': {'readonly': True}, + 'file': {'readonly': True}, + 'web': {'readonly': True}, + 'dfs': {'readonly': True}, + } + + _attribute_map = { + 'blob': {'key': 'blob', 'type': 'str'}, + 'queue': {'key': 'queue', 'type': 'str'}, + 'table': {'key': 'table', 'type': 'str'}, + 'file': {'key': 'file', 'type': 'str'}, + 'web': {'key': 'web', 'type': 'str'}, + 'dfs': {'key': 'dfs', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) + self.blob = None + self.queue = None + self.table = None + self.file = None + self.web = None + self.dfs = None + + +class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): + """The parameters used to regenerate the storage account key. + + All required parameters must be populated in order to send to Azure. + + :ivar key_name: Required. The name of storage keys that want to be regenerated, possible values + are key1, key2, kerb1, kerb2. + :vartype key_name: str + """ + + _validation = { + 'key_name': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + **kwargs + ): + """ + :keyword key_name: Required. The name of storage keys that want to be regenerated, possible + values are key1, key2, kerb1, kerb2. + :paramtype key_name: str + """ + super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) + self.key_name = key_name + + +class StorageAccountUpdateParameters(msrest.serialization.Model): + """The parameters that can be provided when updating the storage account properties. + + :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, + Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + :vartype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :ivar tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in + length than 128 characters and a value no greater in length than 256 characters. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storage.v2021_08_01.models.Identity + :ivar kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :vartype kind: str or ~azure.mgmt.storage.v2021_08_01.models.Kind + :ivar custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :vartype custom_domain: ~azure.mgmt.storage.v2021_08_01.models.CustomDomain + :ivar encryption: Not applicable. Azure Storage encryption at rest is enabled by default for + all storage accounts and cannot be disabled. + :vartype encryption: ~azure.mgmt.storage.v2021_08_01.models.Encryption + :ivar sas_policy: SasPolicy assigned to the storage account. + :vartype sas_policy: ~azure.mgmt.storage.v2021_08_01.models.SasPolicy + :ivar key_policy: KeyPolicy assigned to the storage account. + :vartype key_policy: ~azure.mgmt.storage.v2021_08_01.models.KeyPolicy + :ivar access_tier: Required for storage accounts where kind = BlobStorage. The access tier used + for billing. Possible values include: "Hot", "Cool". + :vartype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.AccessTier + :ivar azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :vartype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_08_01.models.AzureFilesIdentityBasedAuthentication + :ivar enable_https_traffic_only: Allows https traffic only to storage service if sets to true. + :vartype enable_https_traffic_only: bool + :ivar is_sftp_enabled: Enables Secure File Transfer Protocol, if set to true. + :vartype is_sftp_enabled: bool + :ivar is_local_user_enabled: Enables local users feature, if set to true. + :vartype is_local_user_enabled: bool + :ivar network_rule_set: Network rule set. + :vartype network_rule_set: ~azure.mgmt.storage.v2021_08_01.models.NetworkRuleSet + :ivar large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :vartype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_08_01.models.LargeFileSharesState + :ivar routing_preference: Maintains information about the network routing choice opted by the + user for data transfer. + :vartype routing_preference: ~azure.mgmt.storage.v2021_08_01.models.RoutingPreference + :ivar allow_blob_public_access: Allow or disallow public access to all blobs or containers in + the storage account. The default interpretation is true for this property. + :vartype allow_blob_public_access: bool + :ivar minimum_tls_version: Set the minimum TLS version to be permitted on requests to storage. + The default interpretation is TLS 1.0 for this property. Possible values include: "TLS1_0", + "TLS1_1", "TLS1_2". + :vartype minimum_tls_version: str or ~azure.mgmt.storage.v2021_08_01.models.MinimumTlsVersion + :ivar allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :vartype allow_shared_key_access: bool + :ivar allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :vartype allow_cross_tenant_replication: bool + :ivar default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :vartype default_to_o_auth_authentication: bool + :ivar public_network_access: Allow or disallow public network access to Storage Account. Value + is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.storage.v2021_08_01.models.PublicNetworkAccess + :ivar immutable_storage_with_versioning: The property is immutable and can only be set to true + at the account creation time. When set to true, it enables object level immutability for all + the containers in the account by default. + :vartype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageAccount + :ivar allowed_copy_scope: Restrict copy to and from Storage Accounts within an AAD tenant or + with Private Links to the same VNet. Possible values include: "PrivateLink", "AAD". + :vartype allowed_copy_scope: str or ~azure.mgmt.storage.v2021_08_01.models.AllowedCopyScope + """ + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'sas_policy': {'key': 'properties.sasPolicy', 'type': 'SasPolicy'}, + 'key_policy': {'key': 'properties.keyPolicy', 'type': 'KeyPolicy'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'azure_files_identity_based_authentication': {'key': 'properties.azureFilesIdentityBasedAuthentication', 'type': 'AzureFilesIdentityBasedAuthentication'}, + 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, + 'is_sftp_enabled': {'key': 'properties.isSftpEnabled', 'type': 'bool'}, + 'is_local_user_enabled': {'key': 'properties.isLocalUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, + 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, + 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, + 'allow_blob_public_access': {'key': 'properties.allowBlobPublicAccess', 'type': 'bool'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'allow_shared_key_access': {'key': 'properties.allowSharedKeyAccess', 'type': 'bool'}, + 'allow_cross_tenant_replication': {'key': 'properties.allowCrossTenantReplication', 'type': 'bool'}, + 'default_to_o_auth_authentication': {'key': 'properties.defaultToOAuthAuthentication', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'immutable_storage_with_versioning': {'key': 'properties.immutableStorageWithVersioning', 'type': 'ImmutableStorageAccount'}, + 'allowed_copy_scope': {'key': 'properties.allowedCopyScope', 'type': 'str'}, + } + + def __init__( + self, + *, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["Identity"] = None, + kind: Optional[Union[str, "Kind"]] = None, + custom_domain: Optional["CustomDomain"] = None, + encryption: Optional["Encryption"] = None, + sas_policy: Optional["SasPolicy"] = None, + key_policy: Optional["KeyPolicy"] = None, + access_tier: Optional[Union[str, "AccessTier"]] = None, + azure_files_identity_based_authentication: Optional["AzureFilesIdentityBasedAuthentication"] = None, + enable_https_traffic_only: Optional[bool] = None, + is_sftp_enabled: Optional[bool] = None, + is_local_user_enabled: Optional[bool] = None, + network_rule_set: Optional["NetworkRuleSet"] = None, + large_file_shares_state: Optional[Union[str, "LargeFileSharesState"]] = None, + routing_preference: Optional["RoutingPreference"] = None, + allow_blob_public_access: Optional[bool] = None, + minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, + allow_shared_key_access: Optional[bool] = None, + allow_cross_tenant_replication: Optional[bool] = None, + default_to_o_auth_authentication: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + immutable_storage_with_versioning: Optional["ImmutableStorageAccount"] = None, + allowed_copy_scope: Optional[Union[str, "AllowedCopyScope"]] = None, + **kwargs + ): + """ + :keyword sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to + Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any + other value. + :paramtype sku: ~azure.mgmt.storage.v2021_08_01.models.Sku + :keyword tags: A set of tags. Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource (across resource + groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no + greater in length than 128 characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storage.v2021_08_01.models.Identity + :keyword kind: Optional. Indicates the type of storage account. Currently only StorageV2 value + supported by server. Possible values include: "Storage", "StorageV2", "BlobStorage", + "FileStorage", "BlockBlobStorage". + :paramtype kind: str or ~azure.mgmt.storage.v2021_08_01.models.Kind + :keyword custom_domain: Custom domain assigned to the storage account by the user. Name is the + CNAME source. Only one custom domain is supported per storage account at this time. To clear + the existing custom domain, use an empty string for the custom domain name property. + :paramtype custom_domain: ~azure.mgmt.storage.v2021_08_01.models.CustomDomain + :keyword encryption: Not applicable. Azure Storage encryption at rest is enabled by default for + all storage accounts and cannot be disabled. + :paramtype encryption: ~azure.mgmt.storage.v2021_08_01.models.Encryption + :keyword sas_policy: SasPolicy assigned to the storage account. + :paramtype sas_policy: ~azure.mgmt.storage.v2021_08_01.models.SasPolicy + :keyword key_policy: KeyPolicy assigned to the storage account. + :paramtype key_policy: ~azure.mgmt.storage.v2021_08_01.models.KeyPolicy + :keyword access_tier: Required for storage accounts where kind = BlobStorage. The access tier + used for billing. Possible values include: "Hot", "Cool". + :paramtype access_tier: str or ~azure.mgmt.storage.v2021_08_01.models.AccessTier + :keyword azure_files_identity_based_authentication: Provides the identity based authentication + settings for Azure Files. + :paramtype azure_files_identity_based_authentication: + ~azure.mgmt.storage.v2021_08_01.models.AzureFilesIdentityBasedAuthentication + :keyword enable_https_traffic_only: Allows https traffic only to storage service if sets to + true. + :paramtype enable_https_traffic_only: bool + :keyword is_sftp_enabled: Enables Secure File Transfer Protocol, if set to true. + :paramtype is_sftp_enabled: bool + :keyword is_local_user_enabled: Enables local users feature, if set to true. + :paramtype is_local_user_enabled: bool + :keyword network_rule_set: Network rule set. + :paramtype network_rule_set: ~azure.mgmt.storage.v2021_08_01.models.NetworkRuleSet + :keyword large_file_shares_state: Allow large file shares if sets to Enabled. It cannot be + disabled once it is enabled. Possible values include: "Disabled", "Enabled". + :paramtype large_file_shares_state: str or + ~azure.mgmt.storage.v2021_08_01.models.LargeFileSharesState + :keyword routing_preference: Maintains information about the network routing choice opted by + the user for data transfer. + :paramtype routing_preference: ~azure.mgmt.storage.v2021_08_01.models.RoutingPreference + :keyword allow_blob_public_access: Allow or disallow public access to all blobs or containers + in the storage account. The default interpretation is true for this property. + :paramtype allow_blob_public_access: bool + :keyword minimum_tls_version: Set the minimum TLS version to be permitted on requests to + storage. The default interpretation is TLS 1.0 for this property. Possible values include: + "TLS1_0", "TLS1_1", "TLS1_2". + :paramtype minimum_tls_version: str or ~azure.mgmt.storage.v2021_08_01.models.MinimumTlsVersion + :keyword allow_shared_key_access: Indicates whether the storage account permits requests to be + authorized with the account access key via Shared Key. If false, then all requests, including + shared access signatures, must be authorized with Azure Active Directory (Azure AD). The + default value is null, which is equivalent to true. + :paramtype allow_shared_key_access: bool + :keyword allow_cross_tenant_replication: Allow or disallow cross AAD tenant object replication. + The default interpretation is true for this property. + :paramtype allow_cross_tenant_replication: bool + :keyword default_to_o_auth_authentication: A boolean flag which indicates whether the default + authentication is OAuth or not. The default interpretation is false for this property. + :paramtype default_to_o_auth_authentication: bool + :keyword public_network_access: Allow or disallow public network access to Storage Account. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.storage.v2021_08_01.models.PublicNetworkAccess + :keyword immutable_storage_with_versioning: The property is immutable and can only be set to + true at the account creation time. When set to true, it enables object level immutability for + all the containers in the account by default. + :paramtype immutable_storage_with_versioning: + ~azure.mgmt.storage.v2021_08_01.models.ImmutableStorageAccount + :keyword allowed_copy_scope: Restrict copy to and from Storage Accounts within an AAD tenant or + with Private Links to the same VNet. Possible values include: "PrivateLink", "AAD". + :paramtype allowed_copy_scope: str or ~azure.mgmt.storage.v2021_08_01.models.AllowedCopyScope + """ + super(StorageAccountUpdateParameters, self).__init__(**kwargs) + self.sku = sku + self.tags = tags + self.identity = identity + self.kind = kind + self.custom_domain = custom_domain + self.encryption = encryption + self.sas_policy = sas_policy + self.key_policy = key_policy + self.access_tier = access_tier + self.azure_files_identity_based_authentication = azure_files_identity_based_authentication + self.enable_https_traffic_only = enable_https_traffic_only + self.is_sftp_enabled = is_sftp_enabled + self.is_local_user_enabled = is_local_user_enabled + self.network_rule_set = network_rule_set + self.large_file_shares_state = large_file_shares_state + self.routing_preference = routing_preference + self.allow_blob_public_access = allow_blob_public_access + self.minimum_tls_version = minimum_tls_version + self.allow_shared_key_access = allow_shared_key_access + self.allow_cross_tenant_replication = allow_cross_tenant_replication + self.default_to_o_auth_authentication = default_to_o_auth_authentication + self.public_network_access = public_network_access + self.immutable_storage_with_versioning = immutable_storage_with_versioning + self.allowed_copy_scope = allowed_copy_scope + + +class StorageQueue(Resource): + """StorageQueue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar metadata: A name-value pair that represents queue metadata. + :vartype metadata: dict[str, str] + :ivar approximate_message_count: Integer indicating an approximate number of messages in the + queue. This number is not lower than the actual number of messages in the queue, but could be + higher. + :vartype approximate_message_count: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'approximate_message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'approximate_message_count': {'key': 'properties.approximateMessageCount', 'type': 'int'}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ + super(StorageQueue, self).__init__(**kwargs) + self.metadata = metadata + self.approximate_message_count = None + + +class StorageSkuListResult(msrest.serialization.Model): + """The response from the List Storage SKUs operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Get the list result of storage SKUs and their properties. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.SkuInformation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuInformation]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageSkuListResult, self).__init__(**kwargs) + self.value = None + + +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.storage.v2021_08_01.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.storage.v2021_08_01.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.storage.v2021_08_01.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.storage.v2021_08_01.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 Table(Resource): + """Properties of the table, including Id, resource name, resource type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar table_name: Table name under the specified account. + :vartype table_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Table, self).__init__(**kwargs) + self.table_name = None + + +class TableServiceProperties(Resource): + """The properties of a storage account’s Table service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :vartype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, + } + + def __init__( + self, + *, + cors: Optional["CorsRules"] = None, + **kwargs + ): + """ + :keyword cors: Specifies CORS rules for the Table service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Table service. + :paramtype cors: ~azure.mgmt.storage.v2021_08_01.models.CorsRules + """ + super(TableServiceProperties, self).__init__(**kwargs) + self.cors = cors + + +class TagFilter(msrest.serialization.Model): + """Blob index tag based filtering for blob objects. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. This is the filter tag name, it can have 1 - 128 characters. + :vartype name: str + :ivar op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :vartype op: str + :ivar value: Required. This is the filter tag value field used for tag based filtering, it can + have 0 - 256 characters. + :vartype value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'op': {'required': True}, + 'value': {'required': True, 'max_length': 256, 'min_length': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'op': {'key': 'op', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + op: str, + value: str, + **kwargs + ): + """ + :keyword name: Required. This is the filter tag name, it can have 1 - 128 characters. + :paramtype name: str + :keyword op: Required. This is the comparison operator which is used for object comparison and + filtering. Only == (equality operator) is currently supported. + :paramtype op: str + :keyword value: Required. This is the filter tag value field used for tag based filtering, it + can have 0 - 256 characters. + :paramtype value: str + """ + super(TagFilter, self).__init__(**kwargs) + self.name = name + self.op = op + self.value = value + + +class TagProperty(msrest.serialization.Model): + """A tag of the LegalHold of a blob container. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tag: The tag value. + :vartype tag: str + :ivar timestamp: Returns the date and time the tag was added. + :vartype timestamp: ~datetime.datetime + :ivar object_identifier: Returns the Object ID of the user who added the tag. + :vartype object_identifier: str + :ivar tenant_id: Returns the Tenant ID that issued the token for the user who added the tag. + :vartype tenant_id: str + :ivar upn: Returns the User Principal Name of the user who added the tag. + :vartype upn: str + """ + + _validation = { + 'tag': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'object_identifier': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'upn': {'readonly': True}, + } + + _attribute_map = { + 'tag': {'key': 'tag', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'upn': {'key': 'upn', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TagProperty, self).__init__(**kwargs) + self.tag = None + self.timestamp = None + self.object_identifier = None + self.tenant_id = None + self.upn = None + + +class UpdateHistoryProperty(msrest.serialization.Model): + """An update history of the ImmutabilityPolicy of a blob container. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar update: The ImmutabilityPolicy update type of a blob container, possible values include: + put, lock and extend. Possible values include: "put", "lock", "extend". + :vartype update: str or ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicyUpdateType + :ivar immutability_period_since_creation_in_days: The immutability period for the blobs in the + container since the policy creation, in days. + :vartype immutability_period_since_creation_in_days: int + :ivar timestamp: Returns the date and time the ImmutabilityPolicy was updated. + :vartype timestamp: ~datetime.datetime + :ivar object_identifier: Returns the Object ID of the user who updated the ImmutabilityPolicy. + :vartype object_identifier: str + :ivar tenant_id: Returns the Tenant ID that issued the token for the user who updated the + ImmutabilityPolicy. + :vartype tenant_id: str + :ivar upn: Returns the User Principal Name of the user who updated the ImmutabilityPolicy. + :vartype upn: str + :ivar allow_protected_append_writes: This property can only be changed for unlocked time-based + retention policies. When enabled, new blocks can be written to an append blob while maintaining + immutability protection and compliance. Only new blocks can be added and any existing blocks + cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy + API. + :vartype allow_protected_append_writes: bool + :ivar allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :vartype allow_protected_append_writes_all: bool + """ + + _validation = { + 'update': {'readonly': True}, + 'immutability_period_since_creation_in_days': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'object_identifier': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'upn': {'readonly': True}, + } + + _attribute_map = { + 'update': {'key': 'update', 'type': 'str'}, + 'immutability_period_since_creation_in_days': {'key': 'immutabilityPeriodSinceCreationInDays', 'type': 'int'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'object_identifier': {'key': 'objectIdentifier', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'upn': {'key': 'upn', 'type': 'str'}, + 'allow_protected_append_writes': {'key': 'allowProtectedAppendWrites', 'type': 'bool'}, + 'allow_protected_append_writes_all': {'key': 'allowProtectedAppendWritesAll', 'type': 'bool'}, + } + + def __init__( + self, + *, + allow_protected_append_writes: Optional[bool] = None, + allow_protected_append_writes_all: Optional[bool] = None, + **kwargs + ): + """ + :keyword allow_protected_append_writes: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to an append blob while + maintaining immutability protection and compliance. Only new blocks can be added and any + existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. + :paramtype allow_protected_append_writes: bool + :keyword allow_protected_append_writes_all: This property can only be changed for unlocked + time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock + Blobs' while maintaining immutability protection and compliance. Only new blocks can be added + and any existing blocks cannot be modified or deleted. This property cannot be changed with + ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + 'allowProtectedAppendWritesAll' properties are mutually exclusive. + :paramtype allow_protected_append_writes_all: bool + """ + super(UpdateHistoryProperty, self).__init__(**kwargs) + self.update = None + self.immutability_period_since_creation_in_days = None + self.timestamp = None + self.object_identifier = None + self.tenant_id = None + self.upn = None + self.allow_protected_append_writes = allow_protected_append_writes + self.allow_protected_append_writes_all = allow_protected_append_writes_all + + +class Usage(msrest.serialization.Model): + """Describes Storage Resource Usage. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", + "Percent", "CountsPerSecond", "BytesPerSecond". + :vartype unit: str or ~azure.mgmt.storage.v2021_08_01.models.UsageUnit + :ivar current_value: Gets the current count of the allocated resources in the subscription. + :vartype current_value: int + :ivar limit: Gets the maximum count of the resources that can be allocated in the subscription. + :vartype limit: int + :ivar name: Gets the name of the type of usage. + :vartype name: ~azure.mgmt.storage.v2021_08_01.models.UsageName + """ + + _validation = { + 'unit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'limit': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'UsageName'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Usage, self).__init__(**kwargs) + self.unit = None + self.current_value = None + self.limit = None + self.name = None + + +class UsageListResult(msrest.serialization.Model): + """The response from the List Usages operation. + + :ivar value: Gets or sets the list of Storage Resource Usages. + :vartype value: list[~azure.mgmt.storage.v2021_08_01.models.Usage] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + } + + def __init__( + self, + *, + value: Optional[List["Usage"]] = None, + **kwargs + ): + """ + :keyword value: Gets or sets the list of Storage Resource Usages. + :paramtype value: list[~azure.mgmt.storage.v2021_08_01.models.Usage] + """ + super(UsageListResult, self).__init__(**kwargs) + self.value = value + + +class UsageName(msrest.serialization.Model): + """The usage names that can be used; currently limited to StorageAccount. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Gets a string describing the resource name. + :vartype value: str + :ivar localized_value: Gets a localized string describing the resource name. + :vartype localized_value: str + """ + + _validation = { + 'value': {'readonly': True}, + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UsageName, self).__init__(**kwargs) + self.value = None + self.localized_value = None + + +class UserAssignedIdentity(msrest.serialization.Model): + """UserAssignedIdentity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the identity. + :vartype principal_id: str + :ivar client_id: The client ID of the identity. + :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(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VirtualNetworkRule(msrest.serialization.Model): + """Virtual Network rule. + + All required parameters must be populated in order to send to Azure. + + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :vartype virtual_network_resource_id: str + :ivar action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :vartype action: str + :ivar state: Gets the state of virtual network rule. Possible values include: "Provisioning", + "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". + :vartype state: str or ~azure.mgmt.storage.v2021_08_01.models.State + """ + + _validation = { + 'virtual_network_resource_id': {'required': True}, + } + + _attribute_map = { + 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + virtual_network_resource_id: str, + action: Optional[str] = None, + state: Optional[Union[str, "State"]] = None, + **kwargs + ): + """ + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + :keyword action: The action of virtual network rule. The only acceptable values to pass in are + None and "Allow". The default value is None. + :paramtype action: str + :keyword state: Gets the state of virtual network rule. Possible values include: + "Provisioning", "Deprovisioning", "Succeeded", "Failed", "NetworkSourceDeleted". + :paramtype state: str or ~azure.mgmt.storage.v2021_08_01.models.State + """ + super(VirtualNetworkRule, self).__init__(**kwargs) + self.virtual_network_resource_id = virtual_network_resource_id + self.action = action + self.state = state diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py new file mode 100644 index 000000000000..343311c70233 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py @@ -0,0 +1,528 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Required for storage accounts where kind = BlobStorage. The access tier used for billing. + """ + + HOT = "Hot" + COOL = "Cool" + +class AccountImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The ImmutabilityPolicy state defines the mode of the policy. Disabled state disables the + policy, Unlocked state allows increase and decrease of immutability retention time and also + allows toggling allowProtectedAppendWrites property, Locked state only allows the increase of + the immutability retention time. A policy can only be created in a Disabled or Unlocked state + and can be toggled between the two states. Only a policy in an Unlocked state can transition to + a Locked state which cannot be reverted. + """ + + UNLOCKED = "Unlocked" + LOCKED = "Locked" + DISABLED = "Disabled" + +class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the status indicating whether the primary location of the storage account is available or + unavailable. + """ + + AVAILABLE = "available" + UNAVAILABLE = "unavailable" + +class ActiveDirectoryPropertiesAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the Active Directory account type for Azure Storage. + """ + + USER = "User" + COMPUTER = "Computer" + +class AllowedCopyScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the + same VNet. + """ + + PRIVATE_LINK = "PrivateLink" + AAD = "AAD" + +class BlobInventoryPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "default" + +class BlobRestoreProgressStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The status of blob restore progress. Possible values are: - InProgress: Indicates that blob + restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - + Failed: Indicates that blob restore is failed. + """ + + IN_PROGRESS = "InProgress" + COMPLETE = "Complete" + FAILED = "Failed" + +class Bypass(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are + any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to + bypass none of those traffics. + """ + + NONE = "None" + LOGGING = "Logging" + METRICS = "Metrics" + AZURE_SERVICES = "AzureServices" + +class CorsRuleAllowedMethodsItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DELETE = "DELETE" + GET = "GET" + HEAD = "HEAD" + MERGE = "MERGE" + POST = "POST" + OPTIONS = "OPTIONS" + PUT = "PUT" + +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)): + """Specifies the default action of allow or deny when no other rules match. + """ + + ALLOW = "Allow" + DENY = "Deny" + +class DefaultSharePermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Default share permission for users using Kerberos authentication if RBAC role is not assigned. + """ + + NONE = "None" + STORAGE_FILE_DATA_SMB_SHARE_READER = "StorageFileDataSmbShareReader" + STORAGE_FILE_DATA_SMB_SHARE_CONTRIBUTOR = "StorageFileDataSmbShareContributor" + STORAGE_FILE_DATA_SMB_SHARE_ELEVATED_CONTRIBUTOR = "StorageFileDataSmbShareElevatedContributor" + +class DirectoryServiceOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates the directory service used. + """ + + NONE = "None" + AADDS = "AADDS" + AD = "AD" + +class EnabledProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The authentication protocol that is used for the file share. Can only be specified when + creating a share. + """ + + SMB = "SMB" + NFS = "NFS" + +class EncryptionScopeSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, + Microsoft.KeyVault. + """ + + MICROSOFT_STORAGE = "Microsoft.Storage" + MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" + +class EncryptionScopeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ExpirationAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SAS expiration action. Can only be Log. + """ + + LOG = "Log" + +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of extendedLocation. + """ + + EDGE_ZONE = "EdgeZone" + +class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This is a required field, it specifies the format for the inventory files. + """ + + CSV = "Csv" + PARQUET = "Parquet" + +class GeoReplicationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The status of the secondary location. Possible values are: - Live: Indicates that the secondary + location is active and operational. - Bootstrap: Indicates initial synchronization from the + primary location to the secondary location is in progress.This typically occurs when + replication is first enabled. - Unavailable: Indicates that the secondary location is + temporarily unavailable. + """ + + LIVE = "Live" + BOOTSTRAP = "Bootstrap" + UNAVAILABLE = "Unavailable" + +class HttpProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The protocol permitted for a request made with the account SAS. + """ + + HTTPS_HTTP = "https,http" + HTTPS = "https" + +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class ImmutabilityPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. + """ + + LOCKED = "Locked" + UNLOCKED = "Unlocked" + +class ImmutabilityPolicyUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and + extend. + """ + + PUT = "put" + LOCK = "lock" + EXTEND = "extend" + +class InventoryRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The valid value is Inventory + """ + + INVENTORY = "Inventory" + +class KeyPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Permissions for the key -- read-only or full permissions. + """ + + READ = "Read" + FULL = "Full" + +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, + Microsoft.Keyvault + """ + + MICROSOFT_STORAGE = "Microsoft.Storage" + MICROSOFT_KEYVAULT = "Microsoft.Keyvault" + +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Encryption key type to be used for the encryption service. 'Account' key type implies that an + account-scoped encryption key will be used. 'Service' key type implies that a default service + key is used. + """ + + SERVICE = "Service" + ACCOUNT = "Account" + +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates the type of storage account. + """ + + STORAGE = "Storage" + STORAGE_V2 = "StorageV2" + BLOB_STORAGE = "BlobStorage" + FILE_STORAGE = "FileStorage" + BLOCK_BLOB_STORAGE = "BlockBlobStorage" + +class LargeFileSharesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +class LeaseContainerRequestAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the lease action. Can be one of the available actions. + """ + + ACQUIRE = "Acquire" + RENEW = "Renew" + CHANGE = "Change" + RELEASE = "Release" + BREAK_ENUM = "Break" + +class LeaseDuration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies whether the lease on a container is of infinite or fixed duration, only when the + container is leased. + """ + + INFINITE = "Infinite" + FIXED = "Fixed" + +class LeaseShareAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the lease action. Can be one of the available actions. + """ + + ACQUIRE = "Acquire" + RENEW = "Renew" + CHANGE = "Change" + RELEASE = "Release" + BREAK_ENUM = "Break" + +class LeaseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Lease state of the container. + """ + + AVAILABLE = "Available" + LEASED = "Leased" + EXPIRED = "Expired" + BREAKING = "Breaking" + BROKEN = "Broken" + +class LeaseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The lease status of the container. + """ + + LOCKED = "Locked" + UNLOCKED = "Unlocked" + +class ListContainersInclude(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DELETED = "deleted" + +class ManagementPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "default" + +class MigrationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This property denotes the container level immutability to object level immutability migration + state. + """ + + IN_PROGRESS = "InProgress" + COMPLETED = "Completed" + +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Set the minimum TLS version to be permitted on requests to storage. The default interpretation + is TLS 1.0 for this property. + """ + + TLS1_0 = "TLS1_0" + TLS1_1 = "TLS1_1" + TLS1_2 = "TLS1_2" + +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Name of the policy. The valid value is AccessTimeTracking. This field is currently read only + """ + + ACCESS_TIME_TRACKING = "AccessTimeTracking" + +class ObjectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This is a required field. This field specifies the scope of the inventory created either at the + blob or container level. + """ + + BLOB = "Blob" + CONTAINER = "Container" + +class Permissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The signed permissions for the account SAS. Possible values include: Read (r), Write (w), + Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). + """ + + R = "r" + D = "d" + W = "w" + L = "l" + A = "a" + C = "c" + U = "u" + P = "p" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the status of the storage account at the time the operation was called. + """ + + CREATING = "Creating" + RESOLVING_DNS = "ResolvingDNS" + SUCCEEDED = "Succeeded" + +class PublicAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies whether data in the container may be accessed publicly and the level of access. + """ + + CONTAINER = "Container" + BLOB = "Blob" + NONE = "None" + +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Allow or disallow public network access to Storage Account. Value is optional but if passed in, + must be 'Enabled' or 'Disabled'. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason that a storage account name could not be used. The Reason element is only + returned if NameAvailable is false. + """ + + ACCOUNT_NAME_INVALID = "AccountNameInvalid" + ALREADY_EXISTS = "AlreadyExists" + +class ReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The reason for the restriction. As of now this can be "QuotaId" or + "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the + subscription does not belong to that quota. The "NotAvailableForSubscription" is related to + capacity at DC. + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class RootSquashType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The property is for NFS share only. The default is NoRootSquash. + """ + + NO_ROOT_SQUASH = "NoRootSquash" + ROOT_SQUASH = "RootSquash" + ALL_SQUASH = "AllSquash" + +class RoutingChoice(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Routing Choice defines the kind of network routing opted by the user. + """ + + MICROSOFT_ROUTING = "MicrosoftRouting" + INTERNET_ROUTING = "InternetRouting" + +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The valid value is Lifecycle + """ + + LIFECYCLE = "Lifecycle" + +class Schedule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This is a required field. This field is used to schedule an inventory formation. + """ + + DAILY = "Daily" + WEEKLY = "Weekly" + +class Services(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The signed services accessible with the account SAS. Possible values include: Blob (b), Queue + (q), Table (t), File (f). + """ + + B = "b" + Q = "q" + T = "t" + F = "f" + +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), + Hot, and Cool. FileStorage account can choose Premium. + """ + + TRANSACTION_OPTIMIZED = "TransactionOptimized" + HOT = "Hot" + COOL = "Cool" + PREMIUM = "Premium" + +class SignedResource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The signed services accessible with the service SAS. Possible values include: Blob (b), + Container (c), File (f), Share (s). + """ + + B = "b" + C = "c" + F = "f" + S = "s" + +class SignedResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The signed resource types that are accessible with the account SAS. Service (s): Access to + service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to + object-level APIs for blobs, queue messages, table entities, and files. + """ + + S = "s" + C = "c" + O = "o" + +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU name. Required for account creation; optional for update. Note that in older versions, + SKU name was called accountType. + """ + + STANDARD_LRS = "Standard_LRS" + STANDARD_GRS = "Standard_GRS" + STANDARD_RAGRS = "Standard_RAGRS" + STANDARD_ZRS = "Standard_ZRS" + PREMIUM_LRS = "Premium_LRS" + PREMIUM_ZRS = "Premium_ZRS" + STANDARD_GZRS = "Standard_GZRS" + STANDARD_RAGZRS = "Standard_RAGZRS" + +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU tier. This is based on the SKU name. + """ + + STANDARD = "Standard" + PREMIUM = "Premium" + +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the state of virtual network rule. + """ + + PROVISIONING = "Provisioning" + DEPROVISIONING = "Deprovisioning" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + NETWORK_SOURCE_DELETED = "NetworkSourceDeleted" + +class StorageAccountExpand(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + GEO_REPLICATION_STATS = "geoReplicationStats" + BLOB_RESTORE_STATUS = "blobRestoreStatus" + +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the unit of measurement. + """ + + COUNT = "Count" + BYTES = "Bytes" + SECONDS = "Seconds" + PERCENT = "Percent" + COUNTS_PER_SECOND = "CountsPerSecond" + BYTES_PER_SECOND = "BytesPerSecond" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py new file mode 100644 index 000000000000..4c1064ae3825 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._skus_operations import SkusOperations +from ._storage_accounts_operations import StorageAccountsOperations +from ._deleted_accounts_operations import DeletedAccountsOperations +from ._usages_operations import UsagesOperations +from ._management_policies_operations import ManagementPoliciesOperations +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations +from ._local_users_operations import LocalUsersOperations +from ._encryption_scopes_operations import EncryptionScopesOperations +from ._blob_services_operations import BlobServicesOperations +from ._blob_containers_operations import BlobContainersOperations +from ._file_services_operations import FileServicesOperations +from ._file_shares_operations import FileSharesOperations +from ._queue_services_operations import QueueServicesOperations +from ._queue_operations import QueueOperations +from ._table_services_operations import TableServicesOperations +from ._table_operations import TableOperations + +__all__ = [ + 'Operations', + 'SkusOperations', + 'StorageAccountsOperations', + 'DeletedAccountsOperations', + 'UsagesOperations', + 'ManagementPoliciesOperations', + 'BlobInventoryPoliciesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ObjectReplicationPoliciesOperations', + 'LocalUsersOperations', + 'EncryptionScopesOperations', + 'BlobServicesOperations', + 'BlobContainersOperations', + 'FileServicesOperations', + 'FileSharesOperations', + 'QueueServicesOperations', + 'QueueOperations', + 'TableServicesOperations', + 'TableOperations', +] diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py new file mode 100644 index 000000000000..2880c2b81dd9 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py @@ -0,0 +1,1719 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, '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_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_clear_legal_hold_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_or_update_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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] + + immutability_policy_name = "default" + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + immutability_policy_name = "default" + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "immutabilityPolicyName": _SERIALIZER.url("immutability_policy_name", immutability_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_lock_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + *, + if_match: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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_extend_immutability_policy_request( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + 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 + ) + + +def build_lease_request( + resource_group_name: str, + account_name: str, + container_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_object_level_worm_request_initial( + resource_group_name: str, + account_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "containerName": _SERIALIZER.url("container_name", container_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 + ) + +class BlobContainersOperations(object): + """BlobContainersOperations 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.storage.v2021_08_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, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + include: Optional[Union[str, "_models.ListContainersInclude"]] = None, + **kwargs: Any + ) -> Iterable["_models.ListContainerItems"]: + """Lists all containers and does not support a prefix like data plane. Also SRP today does not + return continuation token. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param maxpagesize: Optional. Specified maximum number of containers that can be included in + the list. + :type maxpagesize: str + :param filter: Optional. When specified, only container names starting with the filter will be + listed. + :type filter: str + :param include: Optional, used to include the properties for soft deleted blob containers. + :type include: str or ~azure.mgmt.storage.v2021_08_01.models.ListContainersInclude + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListContainerItems or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListContainerItems] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainerItems"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + include=include, + 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("ListContainerItems", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'} # type: ignore + + @distributed_trace + def create( + self, + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": + """Creates a new container under the specified account as described by request body. The container + resource includes metadata and properties for that container. It does not include a list of the + blobs contained by the container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param blob_container: Properties of the blob container to create. + :type blob_container: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobContainer, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobContainer"] + 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(blob_container, 'BlobContainer') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('BlobContainer', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BlobContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + container_name: str, + blob_container: "_models.BlobContainer", + **kwargs: Any + ) -> "_models.BlobContainer": + """Updates container properties as specified in request body. Properties not mentioned in the + request will be unchanged. Update fails if the specified container doesn't already exist. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param blob_container: Properties to update for the blob container. + :type blob_container: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobContainer, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobContainer"] + 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(blob_container, 'BlobContainer') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.BlobContainer": + """Gets properties of a specified container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobContainer, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobContainer"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> None: + """Deletes specified container under its account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'} # type: ignore + + + @distributed_trace + def set_legal_hold( + self, + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": + """Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold + follows an append pattern and does not clear out the existing tags that are not specified in + the request. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param legal_hold: The LegalHold property that will be set to a blob container. + :type legal_hold: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LegalHold, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LegalHold"] + 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(legal_hold, 'LegalHold') + + request = build_set_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('LegalHold', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'} # type: ignore + + + @distributed_trace + def clear_legal_hold( + self, + resource_group_name: str, + account_name: str, + container_name: str, + legal_hold: "_models.LegalHold", + **kwargs: Any + ) -> "_models.LegalHold": + """Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent + operation. ClearLegalHold clears out only the specified tags in the request. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param legal_hold: The LegalHold property that will be clear from a blob container. + :type legal_hold: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LegalHold, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LegalHold"] + 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(legal_hold, 'LegalHold') + + request = build_clear_legal_hold_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.clear_legal_hold.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('LegalHold', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + clear_legal_hold.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'} # type: ignore + + + @distributed_trace + def create_or_update_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but + not required for this operation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob + container. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') + else: + _json = None + + request = build_create_or_update_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + create_or_update_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + + @distributed_trace + def get_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Gets the existing immutability policy along with the corresponding ETag in response headers and + body. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.get_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + + @distributed_trace + def delete_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Aborts an unlocked immutability policy. The response of delete has + immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this + operation. Deleting a locked immutability policy is not allowed, the only way is to delete the + container after deleting all expired blobs inside the policy locked container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + delete_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'} # type: ignore + + + @distributed_trace + def lock_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is + ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lock_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.lock_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + lock_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'} # type: ignore + + + @distributed_trace + def extend_immutability_policy( + self, + resource_group_name: str, + account_name: str, + container_name: str, + if_match: str, + parameters: Optional["_models.ImmutabilityPolicy"] = None, + **kwargs: Any + ) -> "_models.ImmutabilityPolicy": + """Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only + action allowed on a Locked policy will be this action. ETag in If-Match is required for this + operation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param if_match: The entity state (ETag) version of the immutability policy to update. A value + of "*" can be used to apply the operation only if the immutability policy already exists. If + omitted, this operation will always be applied. + :type if_match: str + :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob + container. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImmutabilityPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImmutabilityPolicy"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'ImmutabilityPolicy') + else: + _json = None + + request = build_extend_immutability_policy_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.extend_immutability_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('ImmutabilityPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + extend_immutability_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'} # type: ignore + + + @distributed_trace + def lease( + self, + resource_group_name: str, + account_name: str, + container_name: str, + parameters: Optional["_models.LeaseContainerRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseContainerResponse": + """The Lease Container operation establishes and manages a lock on a container for delete + operations. The lock duration can be 15 to 60 seconds, or can be infinite. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_name: str + :param parameters: Lease Container request body. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LeaseContainerResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LeaseContainerResponse"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'LeaseContainerRequest') + else: + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('LeaseContainerResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'} # type: ignore + + + def _object_level_worm_initial( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **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', {})) + + + request = build_object_level_worm_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + template_url=self._object_level_worm_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, {}) + + _object_level_worm_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore + + + @distributed_trace + def begin_object_level_worm( + self, + resource_group_name: str, + account_name: str, + container_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This operation migrates a blob container from container level WORM to object level immutability + enabled container. Prerequisites require a container level immutability policy either in locked + or unlocked state, Account level versioning must be enabled and there should be no Legal hold + on the container. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param container_name: The name of the blob container within the specified storage account. + Blob container names must be between 3 and 63 characters in length and use numbers, lower-case + letters and dash (-) only. Every dash (-) character must be immediately preceded and followed + by a letter or number. + :type container_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, 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._object_level_worm_initial( + resource_group_name=resource_group_name, + account_name=account_name, + container_name=container_name, + 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, lro_options={'final-state-via': 'location'}, **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_object_level_worm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py new file mode 100644 index 000000000000..196432046c2d --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py @@ -0,0 +1,470 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "blobInventoryPolicyName": _SERIALIZER.url("blob_inventory_policy_name", blob_inventory_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobInventoryPoliciesOperations(object): + """BlobInventoryPoliciesOperations 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.storage.v2021_08_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, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": + """Gets the blob inventory policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It + should always be 'default'. + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobInventoryPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobInventoryPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + properties: "_models.BlobInventoryPolicy", + **kwargs: Any + ) -> "_models.BlobInventoryPolicy": + """Sets the blob inventory policy to the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It + should always be 'default'. + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyName + :param properties: The blob inventory policy set to a storage account. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobInventoryPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobInventoryPolicy"] + 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(properties, 'BlobInventoryPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BlobInventoryPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + blob_inventory_policy_name: Union[str, "_models.BlobInventoryPolicyName"], + **kwargs: Any + ) -> None: + """Deletes the blob inventory policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param blob_inventory_policy_name: The name of the storage account blob inventory policy. It + should always be 'default'. + :type blob_inventory_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicyName + :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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + blob_inventory_policy_name=blob_inventory_policy_name, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListBlobInventoryPolicy"]: + """Gets the blob inventory policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListBlobInventoryPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListBlobInventoryPolicy] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobInventoryPolicy"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("ListBlobInventoryPolicy", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py new file mode 100644 index 000000000000..f30d58d02170 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py @@ -0,0 +1,362 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, _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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + blob_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "BlobServicesName": _SERIALIZER.url("blob_services_name", blob_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 BlobServicesOperations(object): + """BlobServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BlobServiceItems"]: + """List blob services of storage account. It returns a collection of one object named default. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BlobServiceItems or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.BlobServiceItems] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceItems"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("BlobServiceItems", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'} # type: ignore + + @distributed_trace + def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.BlobServiceProperties", + **kwargs: Any + ) -> "_models.BlobServiceProperties": + """Sets the properties of a storage account’s Blob service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of a storage account’s Blob service, including properties for + Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceProperties"] + 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(parameters, 'BlobServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('BlobServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + + + @distributed_trace + def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BlobServiceProperties": + """Gets the properties of a storage account’s Blob service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BlobServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('BlobServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py new file mode 100644 index 000000000000..cde710d97c01 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py @@ -0,0 +1,232 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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, _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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + deleted_account_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}') + path_format_arguments = { + "deletedAccountName": _SERIALIZER.url("deleted_account_name", deleted_account_name, 'str', max_length=24, min_length=3), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 DeletedAccountsOperations(object): + """DeletedAccountsOperations 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.storage.v2021_08_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.DeletedAccountListResult"]: + """Lists deleted accounts under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.DeletedAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccountListResult"] + 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( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_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("DeletedAccountListResult", 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts'} # type: ignore + + @distributed_trace + def get( + self, + deleted_account_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedAccount": + """Get properties of specified deleted account resource. + + :param deleted_account_name: Name of the deleted storage account. + :type deleted_account_name: str + :param location: The location of the deleted storage account. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedAccount, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.DeletedAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + deleted_account_name=deleted_account_name, + location=location, + subscription_id=self._config.subscription_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py new file mode 100644 index 000000000000..99cf9669587f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py @@ -0,0 +1,500 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_patch_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + encryption_scope_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "encryptionScopeName": _SERIALIZER.url("encryption_scope_name", encryption_scope_name, 'str', max_length=63, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 EncryptionScopesOperations(object): + """EncryptionScopesOperations 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.storage.v2021_08_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 put( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": + """Synchronously creates or updates an encryption scope under the specified storage account. If an + encryption scope is already created and a subsequent request is issued with different + properties, the encryption scope properties will be updated per the specified request. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param encryption_scope_name: The name of the encryption scope within the specified storage + account. Encryption scope names must be between 3 and 63 characters in length and use numbers, + lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and + followed by a letter or number. + :type encryption_scope_name: str + :param encryption_scope: Encryption scope properties to be used for the create or update. + :type encryption_scope: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScope"] + 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(encryption_scope, 'EncryptionScope') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + + @distributed_trace + def patch( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: "_models.EncryptionScope", + **kwargs: Any + ) -> "_models.EncryptionScope": + """Update encryption scope properties as specified in the request body. Update fails if the + specified encryption scope does not already exist. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param encryption_scope_name: The name of the encryption scope within the specified storage + account. Encryption scope names must be between 3 and 63 characters in length and use numbers, + lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and + followed by a letter or number. + :type encryption_scope_name: str + :param encryption_scope: Encryption scope properties to be used for the update. + :type encryption_scope: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScope"] + 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(encryption_scope, 'EncryptionScope') + + request = build_patch_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + **kwargs: Any + ) -> "_models.EncryptionScope": + """Returns the properties for the specified encryption scope. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param encryption_scope_name: The name of the encryption scope within the specified storage + account. Encryption scope names must be between 3 and 63 characters in length and use numbers, + lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and + followed by a letter or number. + :type encryption_scope_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScope"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + encryption_scope_name=encryption_scope_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EncryptionScope', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionScopeListResult"]: + """Lists all the encryption scopes available under the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EncryptionScopeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.EncryptionScopeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionScopeListResult"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("EncryptionScopeListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py new file mode 100644 index 000000000000..a1bcc6d83fac --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py @@ -0,0 +1,342 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + file_services_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "FileServicesName": _SERIALIZER.url("file_services_name", file_services_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 FileServicesOperations(object): + """FileServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceItems": + """List all file services in storage accounts. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileServiceItems, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceItems + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileServiceItems"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileServiceItems', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} # type: ignore + + + @distributed_trace + def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.FileServiceProperties", + **kwargs: Any + ) -> "_models.FileServiceProperties": + """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource + Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of file services in storage accounts, including CORS + (Cross-Origin Resource Sharing) rules. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileServiceProperties"] + 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(parameters, 'FileServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + + + @distributed_trace + def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.FileServiceProperties": + """Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource + Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py new file mode 100644 index 000000000000..bc7a53301d40 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py @@ -0,0 +1,908 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + 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_update_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if include is not None: + query_parameters['$include'] = _SERIALIZER.query("include", include, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restore_request( + resource_group_name: str, + account_name: str, + share_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_lease_request( + resource_group_name: str, + account_name: str, + share_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "shareName": _SERIALIZER.url("share_name", share_name, 'str', max_length=63, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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 x_ms_snapshot is not None: + header_parameters['x-ms-snapshot'] = _SERIALIZER.header("x_ms_snapshot", x_ms_snapshot, '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 FileSharesOperations(object): + """FileSharesOperations 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.storage.v2021_08_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, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FileShareItems"]: + """Lists all shares. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param maxpagesize: Optional. Specified maximum number of shares that can be included in the + list. + :type maxpagesize: str + :param filter: Optional. When specified, only share names starting with the filter will be + listed. + :type filter: str + :param expand: Optional, used to expand the properties within share's properties. Valid values + are: deleted, snapshots. Should be passed as a string with delimiter ','. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FileShareItems or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.FileShareItems] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShareItems"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + expand=expand, + 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("FileShareItems", 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} # type: ignore + + @distributed_trace + def create( + self, + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": + """Creates a new share under the specified account as described by request body. The share + resource includes metadata and properties for that share. It does not include a list of the + files contained by the share. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param file_share: Properties of the file share to create. + :type file_share: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :param expand: Optional, used to expand the properties within share's properties. Valid values + are: snapshots. Should be passed as a string with delimiter ','. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileShare, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShare"] + 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(file_share, 'FileShare') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + expand=expand, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('FileShare', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FileShare', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + share_name: str, + file_share: "_models.FileShare", + **kwargs: Any + ) -> "_models.FileShare": + """Updates share properties as specified in request body. Properties not mentioned in the request + will not be changed. Update fails if the specified share does not already exist. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param file_share: Properties to update for the file share. + :type file_share: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileShare, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShare"] + 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(file_share, 'FileShare') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileShare', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + share_name: str, + expand: Optional[str] = None, + x_ms_snapshot: Optional[str] = None, + **kwargs: Any + ) -> "_models.FileShare": + """Gets properties of a specified share. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param expand: Optional, used to expand the properties within share's properties. Valid values + are: stats. Should be passed as a string with delimiter ','. + :type expand: str + :param x_ms_snapshot: Optional, used to retrieve properties of a snapshot. + :type x_ms_snapshot: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileShare, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileShare"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + expand=expand, + x_ms_snapshot=x_ms_snapshot, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileShare', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + include: Optional[str] = None, + **kwargs: Any + ) -> None: + """Deletes specified share under its account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param x_ms_snapshot: Optional, used to delete a snapshot. + :type x_ms_snapshot: str + :param include: Optional. Valid values are: snapshots, leased-snapshots, none. The default + value is snapshots. For 'snapshots', the file share is deleted including all of its file share + snapshots. If the file share contains leased-snapshots, the deletion fails. For + 'leased-snapshots', the file share is deleted included all of its file share snapshots + (leased/unleased). For 'none', the file share is deleted if it has no share snapshots. If the + file share contains any snapshots (leased or unleased), the deletion fails. + :type include: 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( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + x_ms_snapshot=x_ms_snapshot, + include=include, + 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.CloudErrorAutoGenerated, 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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} # type: ignore + + + @distributed_trace + def restore( + self, + resource_group_name: str, + account_name: str, + share_name: str, + deleted_share: "_models.DeletedShare", + **kwargs: Any + ) -> None: + """Restore a file share within a valid retention days if share soft delete is enabled. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param deleted_share: + :type deleted_share: ~azure.mgmt.storage.v2021_08_01.models.DeletedShare + :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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deleted_share, 'DeletedShare') + + request = build_restore_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.restore.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'} # type: ignore + + + @distributed_trace + def lease( + self, + resource_group_name: str, + account_name: str, + share_name: str, + x_ms_snapshot: Optional[str] = None, + parameters: Optional["_models.LeaseShareRequest"] = None, + **kwargs: Any + ) -> "_models.LeaseShareResponse": + """The Lease Share operation establishes and manages a lock on a share for delete operations. The + lock duration can be 15 to 60 seconds, or can be infinite. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified storage account. File share + names must be between 3 and 63 characters in length and use numbers, lower-case letters and + dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter + or number. + :type share_name: str + :param x_ms_snapshot: Optional. Specify the snapshot time to lease a snapshot. + :type x_ms_snapshot: str + :param parameters: Lease Share request body. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.LeaseShareRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LeaseShareResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseShareResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LeaseShareResponse"] + 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] + + if parameters is not None: + _json = self._serialize.body(parameters, 'LeaseShareRequest') + else: + _json = None + + request = build_lease_request( + resource_group_name=resource_group_name, + account_name=account_name, + share_name=share_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + x_ms_snapshot=x_ms_snapshot, + template_url=self.lease.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('LeaseShareResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + lease.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py new file mode 100644 index 000000000000..46471e801f50 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py @@ -0,0 +1,636 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + username: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "username": _SERIALIZER.url("username", username, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + username: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "username": _SERIALIZER.url("username", username, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + username: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "username": _SERIALIZER.url("username", username, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + username: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "username": _SERIALIZER.url("username", username, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_regenerate_password_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + username: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "username": _SERIALIZER.url("username", username, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 + ) + +class LocalUsersOperations(object): + """LocalUsersOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.LocalUsers": + """List the local users associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUsers, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUsers + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUsers"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUsers', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> "_models.LocalUser": + """Get the local user of the storage account by username. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUser, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUser"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUser', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + username: str, + properties: "_models.LocalUser", + **kwargs: Any + ) -> "_models.LocalUser": + """Create or update the properties of a local user associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :param properties: The local user associated with a storage account. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.LocalUser + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUser, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUser"] + 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(properties, 'LocalUser') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUser', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> None: + """Deletes the local user associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/localUsers/{username}'} # type: ignore + + + @distributed_trace + def list_keys( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> "_models.LocalUserKeys": + """List SSH authorized keys and shared key of the local user. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUserKeys, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUserKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUserKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys'} # type: ignore + + + @distributed_trace + def regenerate_password( + self, + resource_group_name: str, + account_name: str, + username: str, + **kwargs: Any + ) -> "_models.LocalUserRegeneratePasswordResult": + """Regenerate the local user SSH password. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param username: The name of local user. The username must contain lowercase letters and + numbers only. It must be unique only within the storage account. + :type username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalUserRegeneratePasswordResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserRegeneratePasswordResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocalUserRegeneratePasswordResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_regenerate_password_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + username=username, + template_url=self.regenerate_password.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LocalUserRegeneratePasswordResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py new file mode 100644 index 000000000000..6305a18ad0dd --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py @@ -0,0 +1,346 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "managementPolicyName": _SERIALIZER.url("management_policy_name", management_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + +class ManagementPoliciesOperations(object): + """ManagementPoliciesOperations 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.storage.v2021_08_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, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> "_models.ManagementPolicy": + """Gets the managementpolicy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param management_policy_name: The name of the Storage Account Management Policy. It should + always be 'default'. + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + properties: "_models.ManagementPolicy", + **kwargs: Any + ) -> "_models.ManagementPolicy": + """Sets the managementpolicy to the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param management_policy_name: The name of the Storage Account Management Policy. It should + always be 'default'. + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyName + :param properties: The ManagementPolicy set to a storage account. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementPolicy"] + 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(properties, 'ManagementPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + management_policy_name: Union[str, "_models.ManagementPolicyName"], + **kwargs: Any + ) -> None: + """Deletes the managementpolicy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param management_policy_name: The name of the Storage Account Management Policy. It should + always be 'default'. + :type management_policy_name: str or + ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicyName + :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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + management_policy_name=management_policy_name, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py new file mode 100644 index 000000000000..cc6cfe89b121 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py @@ -0,0 +1,474 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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, _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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + object_replication_policy_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "objectReplicationPolicyId": _SERIALIZER.url("object_replication_policy_id", object_replication_policy_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 ObjectReplicationPoliciesOperations(object): + """ObjectReplicationPoliciesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ObjectReplicationPolicies"]: + """List the object replication policies associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ObjectReplicationPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicies] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicies"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("ObjectReplicationPolicies", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": + """Get the object replication policy of the storage account by policy ID. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param object_replication_policy_id: For the destination account, provide the value 'default'. + Configure the policy on the destination account first. For the source account, provide the + value of the policy ID that is returned when you download the policy that was defined on the + destination account. The policy is downloaded as a JSON file. + :type object_replication_policy_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ObjectReplicationPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + properties: "_models.ObjectReplicationPolicy", + **kwargs: Any + ) -> "_models.ObjectReplicationPolicy": + """Create or update the object replication policy of the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param object_replication_policy_id: For the destination account, provide the value 'default'. + Configure the policy on the destination account first. For the source account, provide the + value of the policy ID that is returned when you download the policy that was defined on the + destination account. The policy is downloaded as a JSON file. + :type object_replication_policy_id: str + :param properties: The object replication policy set to a storage account. A unique policy ID + will be created if absent. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ObjectReplicationPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectReplicationPolicy"] + 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(properties, 'ObjectReplicationPolicy') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + content_type=content_type, + json=_json, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ObjectReplicationPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + object_replication_policy_id: str, + **kwargs: Any + ) -> None: + """Deletes the object replication policy associated with the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param object_replication_policy_id: For the destination account, provide the value 'default'. + Configure the policy on the destination account first. For the source account, provide the + value of the policy ID that is returned when you download the policy that was defined on the + destination account. The policy is downloaded as a JSON file. + :type object_replication_policy_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + object_replication_policy_id=object_replication_policy_id, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py new file mode 100644 index 000000000000..1e11486587f5 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Storage/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.storage.v2021_08_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 Storage 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.storage.v2021_08_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 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Storage/operations'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..1a9f1098e929 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,466 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, _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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_put_request( + resource_group_name: str, + account_name: str, + subscription_id: 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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( + resource_group_name: str, + account_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + """List all the private endpoint connections associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :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.storage.v2021_08_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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def put( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Update the state of specified private endpoint connection associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection + :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.storage.v2021_08_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.ErrorResponse, 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 + + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + 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.ErrorResponse, 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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..64acdd991c88 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_by_storage_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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.storage.v2021_08_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_storage_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": + """Gets the private link resources that need to be created for a storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_storage_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py new file mode 100644 index 000000000000..1d9a1e461036 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py @@ -0,0 +1,606 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, _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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + queue_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueName": _SERIALIZER.url("queue_name", queue_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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 QueueOperations(object): + """QueueOperations 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.storage.v2021_08_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 create( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": + """Creates a new queue with the specified queue name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_name: str + :param queue: Queue properties and metadata to be created with. + :type queue: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageQueue, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageQueue"] + 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(queue, 'StorageQueue') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + queue: "_models.StorageQueue", + **kwargs: Any + ) -> "_models.StorageQueue": + """Creates a new queue with the specified queue name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_name: str + :param queue: Queue properties and metadata to be created with. + :type queue: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageQueue, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageQueue"] + 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(queue, 'StorageQueue') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.StorageQueue": + """Gets the queue with the specified queue name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageQueue, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes the queue with the specified queue name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param queue_name: A queue name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, + it should begin and end with an alphanumeric character and it cannot have two consecutive + dash(-) characters. + :type queue_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + queue_name=queue_name, + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, 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.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListQueueResource"]: + """Gets a list of all the queues under the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param maxpagesize: Optional, a maximum number of queues that should be included in a list + queue response. + :type maxpagesize: str + :param filter: Optional, When specified, only the queues with a name starting with the given + filter will be listed. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListQueueResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListQueueResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueResource"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + 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("ListQueueResource", 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py new file mode 100644 index 000000000000..248c0e7b94d9 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py @@ -0,0 +1,342 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + queue_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "queueServiceName": _SERIALIZER.url("queue_service_name", queue_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 QueueServicesOperations(object): + """QueueServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.ListQueueServices": + """List all queue services for the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListQueueServices, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListQueueServices + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueueServices"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListQueueServices', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices'} # type: ignore + + + @distributed_trace + def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.QueueServiceProperties", + **kwargs: Any + ) -> "_models.QueueServiceProperties": + """Sets the properties of a storage account’s Queue service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of a storage account’s Queue service, only properties for + Storage Analytics and CORS (Cross-Origin Resource Sharing) rules can be specified. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueServiceProperties"] + 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(parameters, 'QueueServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + + + @distributed_trace + def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.QueueServiceProperties": + """Gets the properties of a storage account’s Queue service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py new file mode 100644 index 000000000000..62404d42c94d --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py @@ -0,0 +1,144 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, _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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 SkusOperations(object): + """SkusOperations 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.storage.v2021_08_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.StorageSkuListResult"]: + """Lists the available SKUs supported by Microsoft.Storage for given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageSkuListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.StorageSkuListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageSkuListResult"] + 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( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_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("StorageSkuListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py new file mode 100644 index 000000000000..f9433cf120c3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py @@ -0,0 +1,1883 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_create_request_initial( + resource_group_name: str, + account_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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( + resource_group_name: str, + account_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + expand: Optional[str] = "kerb", + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, '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_regenerate_key_request( + resource_group_name: str, + account_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_account_sas_request( + resource_group_name: str, + account_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_service_sas_request( + resource_group_name: str, + account_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_failover_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_hierarchical_namespace_migration_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + request_type: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_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['requestType'] = _SERIALIZER.query("request_type", request_type, '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_abort_hierarchical_namespace_migration_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_restore_blob_ranges_request_initial( + resource_group_name: str, + account_name: str, + 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-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_revoke_user_delegation_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + +class StorageAccountsOperations(object): + """StorageAccountsOperations 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.storage.v2021_08_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 check_name_availability( + self, + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Checks that the storage account name is valid and is not already in use. + + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + 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(account_name, 'StorageAccountCheckNameAvailabilityParameters') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] + 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(parameters, 'StorageAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: + """Asynchronously creates a new storage account with the specified parameters. If an account is + already created and a subsequent create request is issued with different properties, the + account properties will be updated. If an account is already created and a subsequent create or + update request is issued with the exact same set of properties, the request will succeed. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide for the created account. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountCreateParameters + :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 StorageAccount or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_08_01.models.StorageAccount] + :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.StorageAccount"] + 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_initial( + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + 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('StorageAccount', 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + """Deletes a storage account in Microsoft Azure. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace + def get_properties( + self, + resource_group_name: str, + account_name: str, + expand: Optional[Union[str, "_models.StorageAccountExpand"]] = None, + **kwargs: Any + ) -> "_models.StorageAccount": + """Returns the properties for the specified storage account including but not limited to name, SKU + name, location, and account status. The ListKeys operation should be used to retrieve storage + keys. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param expand: May be used to expand the properties within account's properties. By default, + data is not included when fetching properties. Currently we only support geoReplicationStats + and blobRestoreStatus. + :type expand: str or ~azure.mgmt.storage.v2021_08_01.models.StorageAccountExpand + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccount, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.get_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.StorageAccountUpdateParameters", + **kwargs: Any + ) -> "_models.StorageAccount": + """The update operation can be used to update the SKU, encryption, access tier, or tags for a + storage account. It can also be used to map the account to a custom domain. Only one custom + domain is supported per storage account; the replacement/change of custom domain is not + supported. In order to replace an old custom domain, the old value must be cleared/unregistered + before a new value can be set. The update of multiple properties is supported. This call does + not change the storage keys for the account. If you want to change the storage account keys, + use the regenerate keys operation. The location and name of the storage account cannot be + changed after creation. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide for the updated account. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccount, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + 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(parameters, 'StorageAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: + """Lists all the storage accounts available under the subscription. Note that storage keys are not + returned; use the ListKeys operation for this. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.StorageAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + 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( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_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("StorageAccountListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountListResult"]: + """Lists all the storage accounts available under the given resource group. Note that storage keys + are not returned; use the ListKeys operation for this. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :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 StorageAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.StorageAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + 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("StorageAccountListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore + + @distributed_trace + def list_keys( + self, + resource_group_name: str, + account_name: str, + expand: Optional[str] = "kerb", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": + """Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage + account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param expand: Specifies type of the key to be listed. Possible value is kerb. The default + value is "kerb". + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountListKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListKeysResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('StorageAccountListKeysResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + account_name: str, + regenerate_key: "_models.StorageAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.StorageAccountListKeysResult": + """Regenerates one of the access keys or Kerberos keys for the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param regenerate_key: Specifies name of the key which should be regenerated -- key1, key2, + kerb1, kerb2. + :type regenerate_key: + ~azure.mgmt.storage.v2021_08_01.models.StorageAccountRegenerateKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountListKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListKeysResult"] + 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(regenerate_key, 'StorageAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('StorageAccountListKeysResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + + + @distributed_trace + def list_account_sas( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.AccountSasParameters", + **kwargs: Any + ) -> "_models.ListAccountSasResponse": + """List SAS credentials of a storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide to list SAS credentials for the storage account. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.AccountSasParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListAccountSasResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListAccountSasResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListAccountSasResponse"] + 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(parameters, 'AccountSasParameters') + + request = build_list_account_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_account_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('ListAccountSasResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_account_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'} # type: ignore + + + @distributed_trace + def list_service_sas( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.ServiceSasParameters", + **kwargs: Any + ) -> "_models.ListServiceSasResponse": + """List service SAS credentials of a specific resource. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide to list service SAS credentials. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.ServiceSasParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListServiceSasResponse, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListServiceSasResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListServiceSasResponse"] + 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(parameters, 'ServiceSasParameters') + + request = build_list_service_sas_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.list_service_sas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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('ListServiceSasResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} # type: ignore + + + def _failover_initial( + self, + resource_group_name: str, + account_name: str, + **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', {})) + + + request = build_failover_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._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, {}) + + _failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + + @distributed_trace + def begin_failover( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Failover request can be triggered for a storage account in case of availability issues. The + failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS + accounts. The secondary cluster will become primary after failover. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, 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._failover_initial( + resource_group_name=resource_group_name, + account_name=account_name, + 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, lro_options={'final-state-via': 'location'}, **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_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} # type: ignore + + def _hierarchical_namespace_migration_initial( + self, + resource_group_name: str, + account_name: str, + request_type: str, + **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', {})) + + + request = build_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + request_type=request_type, + template_url=self._hierarchical_namespace_migration_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, {}) + + _hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore + + + @distributed_trace + def begin_hierarchical_namespace_migration( + self, + resource_group_name: str, + account_name: str, + request_type: str, + **kwargs: Any + ) -> LROPoller[None]: + """Live Migration of storage account to enable Hns. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param request_type: Required. Hierarchical namespace migration type can either be a + hierarchical namespace validation request 'HnsOnValidationRequest' or a hydration request + 'HnsOnHydrationRequest'. The validation request will validate the migration whereas the + hydration request will migrate the account. + :type request_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 + 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 + """ + 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._hierarchical_namespace_migration_initial( + resource_group_name=resource_group_name, + account_name=account_name, + request_type=request_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, lro_options={'final-state-via': 'location'}, **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_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration'} # type: ignore + + def _abort_hierarchical_namespace_migration_initial( + self, + resource_group_name: str, + account_name: str, + **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', {})) + + + request = build_abort_hierarchical_namespace_migration_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._abort_hierarchical_namespace_migration_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, {}) + + _abort_hierarchical_namespace_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore + + + @distributed_trace + def begin_abort_hierarchical_namespace_migration( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Abort live Migration of storage account to enable Hns. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, 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._abort_hierarchical_namespace_migration_initial( + resource_group_name=resource_group_name, + account_name=account_name, + 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, lro_options={'final-state-via': 'location'}, **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_abort_hierarchical_namespace_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration'} # type: ignore + + def _restore_blob_ranges_initial( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> "_models.BlobRestoreStatus": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BlobRestoreStatus"] + 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(parameters, 'BlobRestoreParameters') + + request = build_restore_blob_ranges_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_blob_ranges_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 response.status_code == 200: + deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BlobRestoreStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _restore_blob_ranges_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + + @distributed_trace + def begin_restore_blob_ranges( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.BlobRestoreParameters", + **kwargs: Any + ) -> LROPoller["_models.BlobRestoreStatus"]: + """Restore blobs in the specified blob ranges. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The parameters to provide for restore blob ranges. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.BlobRestoreParameters + :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 BlobRestoreStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storage.v2021_08_01.models.BlobRestoreStatus] + :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.BlobRestoreStatus"] + 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._restore_blob_ranges_initial( + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + 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('BlobRestoreStatus', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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_restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} # type: ignore + + @distributed_trace + def revoke_user_delegation_keys( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + """Revoke user delegation keys. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_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_revoke_user_delegation_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.revoke_user_delegation_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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) + + if cls: + return cls(pipeline_response, None, {}) + + revoke_user_delegation_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py new file mode 100644 index 000000000000..53f14d5e4293 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py @@ -0,0 +1,548 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, _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_create_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_delete_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableName": _SERIALIZER.url("table_name", table_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]{2,62}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableOperations(object): + """TableOperations 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.storage.v2021_08_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 create( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": + """Creates a new table with the specified table name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Table, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Table"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Table', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": + """Creates a new table with the specified table name, under the specified account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Table, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Table"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + template_url=self.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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Table', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.Table": + """Gets the table with the specified table name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Table, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Table"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Table', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + table_name: str, + **kwargs: Any + ) -> None: + """Deletes the table with the specified table name, under the specified account if it exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param table_name: A table name must be unique within a storage account and must be between 3 + and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin + with a numeric character. + :type table_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_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + table_name=table_name, + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, 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.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.ListTableResource"]: + """Gets a list of all the tables under the specified storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListTableResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.ListTableResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableResource"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + 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("ListTableResource", 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py new file mode 100644 index 000000000000..6d5293042490 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py @@ -0,0 +1,342 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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_set_service_properties_request( + resource_group_name: str, + account_name: str, + 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-08-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_get_service_properties_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + table_service_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "tableServiceName": _SERIALIZER.url("table_service_name", table_service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 TableServicesOperations(object): + """TableServicesOperations 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.storage.v2021_08_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, + account_name: str, + **kwargs: Any + ) -> "_models.ListTableServices": + """List all table services for the storage account. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListTableServices, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListTableServices + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListTableServices"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + 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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListTableServices', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices'} # type: ignore + + + @distributed_trace + def set_service_properties( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.TableServiceProperties", + **kwargs: Any + ) -> "_models.TableServiceProperties": + """Sets the properties of a storage account’s Table service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :param parameters: The properties of a storage account’s Table service, only properties for + Storage Analytics and CORS (Cross-Origin Resource Sharing) rules can be specified. + :type parameters: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableServiceProperties"] + 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(parameters, 'TableServiceProperties') + + request = build_set_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.set_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TableServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + + + @distributed_trace + def get_service_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.TableServiceProperties": + """Gets the properties of a storage account’s Table service, including properties for Storage + Analytics and CORS (Cross-Origin Resource Sharing) rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the specified resource group. + Storage account names must be between 3 and 24 characters in length and use numbers and + lower-case letters only. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TableServiceProperties, or the result of cls(response) + :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TableServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_service_properties_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_service_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(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.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TableServiceProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}'} # type: ignore + diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py new file mode 100644 index 000000000000..809f901e61ef --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py @@ -0,0 +1,150 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, _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_by_location_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("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 UsagesOperations(object): + """UsagesOperations 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.storage.v2021_08_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_location( + self, + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: + """Gets the current usage count and the limit for the resources of the location under the + subscription. + + :param location: The location of the Azure Storage resource. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UsageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storage.v2021_08_01.models.UsageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] + 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_location_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + location=location, + 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("UsageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages'} # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/py.typed b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file